+ Start a Discussion
AxxxVAxxxV 

Mass Email from a Trigger

Is it possible to send a mass email from a trigger?

My scenario is:

- invoke trigger by editing a record
- trigger queries a Lead object and retrieves up to 250 records
- trigger constructs a massEmailMessage
- trigger executes "Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });"
- trigger finalizes and commits changes




Message Edited by AxxxV on 09-05-2008 03:46 PM
mikefmikef
Yes it is possible to send mass emails with Apex code.

Please read http://www.salesforce.com/us/developer/docs/apexcode/index_CSH.htm#apex_classes_email_outbound.htm
for info on how to send mass emails.
AxxxVAxxxV
Thank you for quick response. I am aware of the Apex Outbound Email functionality.

My specific question here is whether there are any limitations on sending mass email from inside a trigger. For example APex can make callaout to external web services, but this is not possible from inside a trigger. Just want to make sure there is no such limitation in case of mass emails.



mikefmikef
I don't know of any restriction on Mass Emailing from with in a trigger.
AxxxVAxxxV
I tested this functionality and it appears that there are no restrictions. The mass emails may be executed from inside a trigger.

sfdcfoxsfdcfox
You are limited to your organization's daily mass email limit (normally 1,000 per 24 hours). Please be aware that mass emails you send out through the mass email wizard count towards this limit as well. Exceeding this limit will cause some messages to not be delivered.