How to set From Address for sending emails using Apex?

To set From Address for sending emails using Apex, you have to set Or

1. Go to Email Administration --> Organization-Wide Addresses.

2. Click "Add" button.

3. Enter the information and click "Save" button.

4. Go to the email entered. You would have received an email from Salesforce. Confirm it to verify the email.

5. Go to Developer Console and use the below Query.

SELECT Id, Address, DisplayName FROM OrgWideEmailAddress

6. Store the id in a custom label.

Sample Code:

                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();


No comments:

Post a Comment