Notifications
Clear all
Sep 10, 2021 1:21 am
How to set a specific from email address from the org while sending out emails.
1 Reply
Sep 10, 2021 1:28 am
You could set an org wide email in settup -> Organization-Wide Email Addresses
and use it as the from email id for sending emails:
OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = 'doNotReply@jkj.com'];
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
if ( owea.size() > 0 ) {
mail.setOrgWideEmailAddressId(owea.get(0).Id);
}