+ Start a Discussion

Anyway to change FROM EMAIL ADDRESS while sending an email using singleemailmessage class

Dear All,

I 'd written apex code to send an email using singleemailmessage class. 

While sending this email i want to change the FROM ADDRESS. ByDefault, it is using the user's email id. but i want to set it to 'alerts@companyname.com'. 

Can i change the from address to achieve this?


Please share info!



My OwnMy Own

Can you post your code once. We can change the email id at run time. 


I had the similar problem. Refer this post, it might be helpful: