+ Start a Discussion
mat_tone_84mat_tone_84 

Hide or change sender email

Hi!

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();
            mail.setReplyTo(emailcustom);
            mail.setSenderDisplayName(emailcustom);

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

 

Thanks!

 

 

 

Rasmus MenckeRasmus Mencke

Hi, 

 

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. 

 

 

mat_tone_84mat_tone_84

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 ?