0

Is there a way to set the From Address when sending MassEmailMessage via a batch job? Ideally I want to use OrgWideEmailAddress but I don't see any method to apply that. Neither can I find a way to set the FromAddress.

Am I missing something or is this not possible?

0

As per Salesforce documentation 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.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_sendemail.htm

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. The sending email address in the header is also set to the field defined in OrgWideEmailAddress.Address.

What you can do, create a new user with the desired email ID and run the batch job with that user.

  • Thanks. So the best option I am left with is to use replyTo and senderDisplayName, correct? – RajeshShah Jun 16 '16 at 5:33
  • I have not tried, you can try and post your own answer based on the findings. – Saroj Bera Jun 16 '16 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.