function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Austin V. MalherbeAustin V. Malherbe 

How is Return Path email set?

I'm working to solve an issue where my Controller Class sends an email. I set the ReplyTo and I set the SenderDisplayName those are both correct however. The email visually displays another users email that is no longer at the company. I can't understand or trace how this is being set. When I look at the mail details I see that the return path shows the old users email. We are not using Org Wide Defaults. How else could this from email address be set?
Prateek Singh SengarPrateek Singh Sengar
Hi Austin,
Since you are sending email via apex code I believe the only way to override the from email address would be to set a org wide email. You can do this by 
  • In your code use  mail.setOrgWideEmailAddressId(ID) which requires the ID of an Organization-Wide Address
  • Set your org wide email at Setup | Email Administration | Organization-Wide Addresses
Org wide addresses let you specify both the Display Name and the Email Address in From line of your outgoing mails. Hope this helps
Austin MuellerAustin Mueller
When you say you are not using organization wide defaults, are you talking about the org wide email addresses?

Could you post the apex class you are having the issues with as well?