How to set a specif...
 
Notifications
Clear all

[Solved] How to set a specific from email address in Salesforce

2 Posts
1 Users
0 Likes
1,158 Views
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

How to set a specific from email address from the org while sending out emails.

Issue Tags
1 Reply
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

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);
}
Reply
Share: