+ Start a Discussion
krishna chaitanya 35krishna chaitanya 35 

Send a separate email to each contact

Hello All,
I have a requirement to send a email to contacts.
1.In contact i created a check box send an email
2.i have a custom button to send email onclick,when the button is clicked it will fetch all the contacts marked "send an email=true".Till here i am able to achieve.
3.Constraint-->I need to  send a separate/different email to each and every contact (in To Address )instead of sending to list of contacts (in TO Address).
Can anyone please help me to solve this logic.
Krishna Chaitanya.
You may need a Batch Apex here if you are dealing with thounads of contacts. Limits, Limits!

Create a Batch Apex which will take couple of hundred of contacts at a time in Database.QueryLocator and perform send operation.

I am not sure when you say seperate TO:? I rather put them all in TO and send a personalized email to each of them. I am sure it is obvious but when they (contacts) receives an email, they won't see so many people in TO but rather only him/her self.
krishna chaitanya 35krishna chaitanya 35
Hello Harshil,
Thank you for your prompt response.I mean i want to extract it as a list and send a personalized email.can you please help me with the code to send a personalized/single email.

Here we are performing the operation for 20-50 contacts at a time so there wont be a problem with limits

Hi Krishna,

I would recommend you download the Mass Email app from app exchange and it will allow you to send a personalize emails to each one of your contact records. See the link below,

When you send an email via app, it will ask you to select an email template and this is something that you control. Create a personalize email template such as

Hello {!contact.FirstName} {!Contact.LastName} along these lines...

Make a use of this email template on an App and here you are, sending a personilize email to each one of your conatct.I thoughts you are dealing with thousands of emais and so I have suggested an Apex but in your case, it looks like the appexchange app would do the job just fine!
krishna chaitanya 35krishna chaitanya 35
Hello Harshil ,
Thank you for your response ,but i need to send via apex because i need to fetch the (vf page which renders as a pdf page) which contains contact info along with company info .and i need to send it as a attachment along with email.so i chose sending via apex.can you help me in writing code.