I stuck into a problem that I have to set "from address" in MassEmailMessage. Please suggest me how to achieve this?
2 Answers
You can follow below steps.
click on your name at the top right in salesforce and then choose My Settings.
then click on Email on the left, then on My Email Settings
Now you will see on the right two boxes you can change as below:
How would you like your name to appear on your outgoing email? *Email Name:
What email address would you like to use as your return address? *Email Address
Just change these and save....then when you verify the email address and you test a mass email the From address will no longer be your personal email....but the text and email you put above...and when someone replies it will go to the email address you specified...(Note - your personal email associated with your salesforce account will not change...)
You can not set from address for MassEmailMessage
. The email address of the logged-in user is inserted in the From Address field of the email header.
Only SingleEmailMessage
has an optional field called OrgWideEmailAddressId
. This is an object ID
to an OrgWideEmailAddress
object. If OrgWideEmailAddressId
is set, the OrgWideEmailAddress
.DisplayName
field is used in the email header, instead of the logged-in user's Display Name.
Salesforce doc - https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_sendemail.htm