In Salesforce Apex, the Messaging.SingleEmailMessage class is used to send outbound emails programmatically. By default, outbound emails are sent from the email address of the running user. In some scenarios, it is necessary to override the From address — for example, to send emails from a shared support address or a company-wide noreply address.
This article explains how to override the From address on a Messaging.SingleEmailMessage instance by using an Org-Wide Email Address configured in Salesforce Setup.
To override the From address on a Salesforce Apex SingleEmailMessage, use the setOrgWideEmailAddressId(ID) method. This method accepts the Salesforce ID of an Org-Wide Email Address record and uses that address as the From address when the email is sent.
Reference: SingleEmailMessage methods
000386605

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.