If I need to send a huge amount of emails to 500+ contacts, each email using one of three visualforce templates (syntax needed for translations is available only on Visualforce templates, with
outputPanel tags), how many single messages can I send in a transaction? Considering that the Visualforce template does not have a custom controller. It is used to just render things correctly for each contact.
I'm asking this here because the documentation isn't clear about this.
Also the same documentation states that:
You can specify up to 100 recipients for the To field and up to 25 recipients for the CC and BCC fields in each SingleEmailMessage.
So if I need to send 200 emails with the same template to 200 different people, can I create two instances of
SingleEmailMessage in Apex and pass 100 contact ids to each one?
My main concern here is that I need each one of the 200 emails to render some Contact-related information correctly for its recipient. So all of them can use the same template, but the information should be different (the contact's name, for example).
I've found that the SingleEmailMessage is not the issue here, since I can send more than a thousand messages if I want to, but if
saveAsActivity is true for those messages, then I am limited to less than 100 messages because Salesforce inserts the related task one record at a time (counting towards the transaction DML limits).
I've found an idea for Salesforce to fix this here: https://success.salesforce.com/ideaView?id=0873A000000CTXwQAO