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
abhishektandon2abhishektandon2 

Setting the From Email address in the Email

Hi All,

 

I have a requirement with me in which i want to set the FROM email address in the out going email. i found thet Orgwide email address will resolve my issue. but even after using that only the sender display name is changed the Fromemail address is still the same.

 

Before using Org wide Email address From address in email

no-reply@salesforce.com; on behalf of;<current User name>

 

After using Org wide Email address From address in email ( i have set XXX name xxx@yyy.com)

no-reply@salesforce.com; on behalf of XXX

 

But i am expecting

xxx@yyy.com; on behalf of XXX

 

 

Code

in the code i set setOrgWideEmailAddress

 

mail.setOrgWideEmailAddressid( id of Org wide Email address record id);

 

Please let me know wat exacltly i sthe issue, or do we ave any other solution of setting from address?

 

Best Answer chosen by Admin (Salesforce Developers) 
abhishektandon2abhishektandon2

I am Able to resolve this, no code chnage required.

 

Only i have unchecked the Email Security Compliance under Setup--. Email Administrtion-->Deliverability

 

Thanks for all the help and suuport

All Answers

LukashPLukashP

Hey,
Did you add  email-to-case email address ? Based on my experiments if you have this adddress you can later use it as From address. 

abhishektandon2abhishektandon2

No i have just added an email in Org wide email and using Id of that

 

from the Administrative Setup --> Email Administration --> OrganizationWideEmailAddresses.

LukashPLukashP

I understand, but what I am saying is that for me to have "From" as I wanted I needed to add email-to-case address.

abhishektandon2abhishektandon2

I am Able to resolve this, no code chnage required.

 

Only i have unchecked the Email Security Compliance under Setup--. Email Administrtion-->Deliverability

 

Thanks for all the help and suuport

This was selected as the best answer