Skip to main content
Send email in loops

Prevent uses of Messaging.sendEmail inside loops, to reduce the risk of running into governor limits.

Lorenzo Frattini avatar
Written by Lorenzo Frattini
Updated over 6 years ago

Rationale

Salesforce allows a  limited number of 10 calls to the Messaging.sendEmail method per transaction. This rule checks all invocations of the method to ensure they are not placed within a loop, which would making it very likely to reach or exceed Apex  governor limits.

Scope

  • Apex classes and triggers

Did this answer your question?