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
hoomelhoomel 

SingleEmail vs. MassEmail

Hello,

 

i have fairly general question, but i cannot seem to find any information on this matter:

 

What exactly is the difference between SingleEmailMessage and MassEmailMessage?

 

This is what i know:

  • They both count against different organisation limits

From the Apex Code Documentation I concluded that I can add multiple targetObjectIds for a MassEmail and only one for a single email. Is that correct?

So a MassEmail could be logged as an activity for multiple contacts and a SingleEmail could be logged only for one contact?

 

Maybe someone can confirm this or clear out the differences to me?

 

Regards,

hoomel

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

The difference is the same as between a single email and mass email for the UI. As you have surmised, you can use multiple targets in a mass email, as opposed to a single target in a single email. The other major difference is attachments. Any attachment, even a 1 byte text file, would be sent as a HTML link attachment (try mass emailing yourself so you can get a feel for this), while in a single email the attachment is only sent as an HTML link attachment if the file sizes exceed 3MB. HTML link attachments expire in 30 days, even if the attachment came from a file stored in salesforce.com (e.g. a template's attachment). Other than those two differences, they are identical in behavior. Also, they both count as mass emails when sent through Apex Code/Visualforce, but single emails do not normally count against organization limits. This limit was put in place to avoid people writing a "mass single email" utility.

All Answers

sfdcfoxsfdcfox

The difference is the same as between a single email and mass email for the UI. As you have surmised, you can use multiple targets in a mass email, as opposed to a single target in a single email. The other major difference is attachments. Any attachment, even a 1 byte text file, would be sent as a HTML link attachment (try mass emailing yourself so you can get a feel for this), while in a single email the attachment is only sent as an HTML link attachment if the file sizes exceed 3MB. HTML link attachments expire in 30 days, even if the attachment came from a file stored in salesforce.com (e.g. a template's attachment). Other than those two differences, they are identical in behavior. Also, they both count as mass emails when sent through Apex Code/Visualforce, but single emails do not normally count against organization limits. This limit was put in place to avoid people writing a "mass single email" utility.

This was selected as the best answer
osamanosaman

Adding to above reply, in Single Email you can specify Sender's emaill address if you are using OrganizationWideEmail. But in MassEmail you cannot and current user will be the sender.

 

Thanks

hoomelhoomel

Ok, thank you for the quick information, that was just what I wanted to know!