+ Start a Discussion

Hide or change sender email


I create a trigger which send an email that work properly but I want to changhe or hide the sender email.

I want send an email with custom sender, but I don't find the way to do this.


I have this code into my trigger:


string emailcustom = list_o.get(0).email_custom__c;           
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

in my test the field email_custom__c has this value "test_1@xxx.com"

email of my organization is "myemail@xxx.com"  This email was setup by me on SF here: setup -> personal setup -> email -> My Email Settings


when I send email, the receiver will have in the header of email :

from test_1@xxx.com <myemail@xxx.com>


and now If the receiver reply to me, according to the client (outlook,gmail,yahoomail,...) of email wich he use I will have 2 case:

A - He reply to test_1@xxx.com

B - He reply to myemail@xxx.com


Gmail work properly and so it does the case A, but in the most other case I have the case B


How Can I solve this problem ? I want only the case A






Rasmus MenckeRasmus Mencke



you might want to take a look at the Organization wide email addresses, where you can specify an email address you can use in the API. 


In regards to Case A or B, that could be caused by the email client. The RFC says that the email client should use the "reply-to:" field when replying to an email, and not the header-from address. 




I look "wide email addresses" and I have some email here that I added some months ago.

How can I use it in the API ?