You need to sign in to do that
Don't have an account?
Victor Echeverría
Send email template through apex to various contacts
I want to send an email message using a template to all contacts related to an account when a certain event happens in the account. For this I have created a trigger. The issue is with my "mail.setTargetObjectIds(lstIds)" statement. I recieve the following error: Method does not exist or incorrect signature: void setTargetObjectIds(List<Id>) from the type Messaging.SingleEmailMessage.
The variable lstlds is a list of ids I got by quering all related contacts of the account.What could the error be? Can't I us a list on the setTargetObjectIds function?
The variable lstlds is a list of ids I got by quering all related contacts of the account.What could the error be? Can't I us a list on the setTargetObjectIds function?
Please find the sample code which will send email to various contacts using apex. Basically, add all contact in the list and then send them in a single shot. At one time you can send 100 emails.
I would also suggest you please check with below link which might help you further.
- https://salesforce.stackexchange.com/questions/180980/how-to-send-an-email-template-via-apex
Please let us know if this helps.Kindly mark this as solved if the information was helpful.
Thanks,
Nagendra
All Answers
Please find the sample code which will send email to various contacts using apex. Basically, add all contact in the list and then send them in a single shot. At one time you can send 100 emails.
I would also suggest you please check with below link which might help you further.
- https://salesforce.stackexchange.com/questions/180980/how-to-send-an-email-template-via-apex
Please let us know if this helps.Kindly mark this as solved if the information was helpful.
Thanks,
Nagendra
can you help me in the following code. I want to send email to selected contact's email id using wrapper class:
Your help is awaited
Thanks
Shephali