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
NikhilNikhil 

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).

 

Contact

---------------Enrollment

-------------------------------EnrollmentItems

 

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 !!!!

 

Thanks 

Ispita_NavatarIspita_Navatar

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.

sfd007sfd007

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.

 

Thanks

sfd007