This issue is driving me nuts. Basically, I have an APEX trigger which is supposed to send out emails to customers when new records are available for them to look at.

Everything is working as expected. Except the sender name on the email which is the "From address"

I read the documentation and called these methods as follows:

    // Specify the address used when the recipients reply to the email.  

        mail.setReplyTo('[email protected]');

        // Specify the name used as the display name. 

        mail.setSenderDisplayName('Test Org Account Team');

But the "from address" still shows my email because the trigger is executed by my user.

When the reply button is clicked, the sender is populated to the email address set above. But I do not want my email to show up on the "From address".

Looks like Salesforce is defaulting this to the person who ran the trigger. How can I override this :( ?


2 Answers 2


The only way to modify the From line of a mail is by using the mail.setOrgWideEmailAddressId(ID) which requires the ID of an Organization-Wide Address record defined in Your Name | 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. Documentation

  • 2
    Confirming that I've done this in the past and this is the only proper way of changing the from address on email sent from apex. Commented Jan 4, 2013 at 22:44
  • 1
    Thanks for the answer but unfortunately in my case this could not work since it was not feasible to change the org wide Email ID since the email we wanted to use in this case was related to a specific group and it would not make sense to use it for other applications.
    – Richard N
    Commented Jan 18, 2013 at 17:08
  • I had another requirement and this time it was feasible to change the org wide address. Thanks.
    – Richard N
    Commented Jan 31, 2013 at 16:57

One of the posts suggests that Under "Email Administration" setting one has to check both the checkboxes under the section "Email Security Compliance" . It works fine when one takes the above actions.

did you check if the above was selected ?

Also check out this post from Stackexchange where another user has the exact same question with a solution to the question


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .