Reply
Regular Contributor
Scott0987
Posts: 121
0
Accepted Solution

email list of accounts

Here is the situation.   I have a list of account ID's.  I want to send en email to an email field on each of those accounts.  I have a visualforce template that I want to use as the body of the email.  How do I get the email to go out to each of the accounts and have the fields referenced on the template apply to the account that he email is set to go to?  Maybe I am just overthinking this, but any help would be appreciated, I am expirienced with apex but have never used the email portion of it before.  Thanks.

Regular Contributor
Praful Gadge
Posts: 21
0

Re: email list of accounts

Hi Scott,

 

Here is some example code to get you started.

 

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId(*put id of template here*);
mail.setwhatid(*put id of object record here*);

 

Check out the documentation on APEX Email Classes HERE  .

If this post is your solution, kindly mark this as the solution to the post so that others may benefit.

 

Regards,

Praful G.

Praful G
Regular Contributor
Scott0987
Posts: 121
0

Re: email list of accounts

Thank you for this help.  Between thehelp you gave me, the link you gave me and This Page I was able to figure it all out.