+ Start a Discussion

How to Mass Mailing in Apex where each email has differenct content

Hi Guys,


I have a requirement where my client wants to do a one time mass email activity.


Objects are as follows....

Every contact is associated with more than one enrollment (custom object) and every enrollment has more than 1 enrollment Items(custom object).






So need is to post emails to every contact with the enrollment details (In particulat format like fist display enrollment and then under that enrollmentItems and so on.


I dont know if the Regular massemail functionality of SFDC can be used here.Please suggest if possible.


Also I think this is not possible via Apex as Apex has limitations , like we can not post more then 10 emails in one go using the Messaging.SingleEmailMessag . If we use Messaging.MassEmailMessag then a Email template is required and then how to put different information in every email.


Please help if have any idea about the solution !!!!




You can use the regular mailmerge by bringing  the information that you want to send out at the contact level itself using formula fields or fields having child objects using trigger.

You can also implement the same using visual force and apex based on the MassMailing classes.

Imran MohammedImran Mohammed

Even MassMail has its own  limitations.

why dont you try creating Workflow Email Alert that gets triggered when the contact gets updated to certain value and from there after the mails will be sent to the respective contacts with the actual values merged.


Hope this helps.


Hi Ispita_Navatar - Could you provide sample code OR eloborate on Apex and VF development using MassMailing?


My requirement is to send daily emails to every Owner(Sales user) with a list of all Leads that he own.