NO_MASS_MAIL_PERMISSION Error Fix

Was everything running smoothly and then all of a sudden you started seeing this?

System.EmailException: SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.: []

If you have, you are not alone. I recently reached out to the Salesforce Stackexchange community about the same exact error. I had a unit test failing in a sandbox that was working perfectly in production.

Thankfully, the user Kevin Lam pointed out something interesting in the Spring ’13 release of Salesforce:

Have you checked the “Access to Send Email” option under Administration Setup – Email Administration – Deliverability? It’s new feature in Spring 13.

Turns out, in Spring ’13 Salesforce released “New Controls for Sending Email” (page 46):

We’ve added a way for you to control the type of email your organization sends, with the new Access level setting in Your Name > Setup > Email Administration > Deliverability. While you typically won’t change this setting day-to-day, these options can be useful when you need to temporarily suspend outbound email or when you’re working with sandboxes, for example.

  • No access>: Prevents all outbound email to and from users.
  • System email only: Allows only automatically generated emails, such as new user and password reset emails.
  • All email>: Allows all types of outbound email. Default for new, non-sandbox organizations.

Tip: The System email only setting is especially useful for controlling email sent from sandboxes so that testing and development work doesn’t send test emails to your users.

  • Newly created sandboxes default to System email only.
  • Sandboxes created before ’Spring 13 default to All email.

You may not be able to edit the Access level if salesforce.com has restricted your organization’s ability to change this setting.

This new change is most likely your issue. You may need to set your Deliverability settings to use All email if you have Apex code failing while trying to send email. Good luck!

Advertisement

Go to Smartblog Theme Options -> Ad Management to enter your ad code (300x250)

Comments are closed.