Good Day Everyone,

I have created an email template in salesforce. When I use it to send an email via apex, It uses my current email as from address. Now what I did is that I defreeze my current user that creates the said email template. My question is that, what will happen if I login to another user and use the email template ? What will be the from address it will use ? In short, my question is that what is the correct way to determine the from address when sending and email in salesforce.

Note: I did not set-up the org-wide address for this scenario.

Please help. Thank you...


The documentation is pretty clear on this

The email address of the user calling the sendEmail method is inserted in the From Address field of the email header. All email that is returned, bounced, or received out-of-office replies goes to the user calling the method.

Hence, the running user of the apex class that sends the email will be the 'from' email address.

If you want emails to go out from a consistent email address, use an org-wide email address using the method setOrgWideEmailAddressId(emailAddressId)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.