+ Start a Discussion
the_wolfthe_wolf 

Number of Email Invocations: 10 out of 10 - How to increment this number?

Hi all,

 

I have an Apex trigger that send "N" mails, where n is the records of a custom object. If I insert more than 10 records, I receive the error "Too mail invocation: 11" .

 

I need to send 15 mails or more, but not necessary simultaneously ( for example sending remaining emails after 5 minutes).

 
 Can you give me a suggestion on how can I send more than 10 emails?

 

Thanks in advance!

Best Answer chosen by Admin (Salesforce Developers) 
the_wolfthe_wolf

Thanks for reply dev401has,

 

your idea is great , but after save the record there are more logic functions (other triggers and workflows) to be edit if I use your idea.

 

So, my solution in this case is to bypass the limit of Email Invocation by divide my selected records in N groups

(each contain 10 recipients in BCC addresses ).

 

Each group is an email invocation, so with a particular FOR cycle I incremented my destination addresses to 100 !

(logically the body , subject and other parameters is equal to each mail ) .

 

 

 

All Answers

rmacfirmacfi

Does it make any difference whether you use SingleEmailMessage or MassEmailMessage? In SingleEmailMessage the cap should be on 100 messages though.

the_wolfthe_wolf

Thanks for reply rmacfi.

 

I don't know your information on cap = 100 mails. Do you have a link to this info?

dev401hasdev401has

Email Limit is 10 only. I am also curious to know abt 100.

 

anyways I also faced this same issue few days back. I used workflow for that.

You might be using trigger or class to send the mail, so in that you can update a field (send mail chekbox field).

You can update that field to YES from that trigger or class that you are using to send email.

and in workflow use the condition that if the checkbox field is true then send email. This will let you send the no. of mails you want without any problem.

the_wolfthe_wolf

Thanks for reply dev401has,

 

your idea is great , but after save the record there are more logic functions (other triggers and workflows) to be edit if I use your idea.

 

So, my solution in this case is to bypass the limit of Email Invocation by divide my selected records in N groups

(each contain 10 recipients in BCC addresses ).

 

Each group is an email invocation, so with a particular FOR cycle I incremented my destination addresses to 100 !

(logically the body , subject and other parameters is equal to each mail ) .

 

 

 

This was selected as the best answer
rmacfirmacfi

Well actually a more meaningful restriction is the limit method that sets the cap on 10 email calls per transaction. However you can have up to 100 recipients on a single message which would then be one email call.

 

There is also a limit depending on which edition of Force.com is being used. If you exceed this limit, the error message would be MASS_MAIL_LIMIT_EXCEEDED