I have a full sandbox where Deliverability has been set to System Email Only
. I already know how to change this to All Email
but we have other reasons for not doing this (mainly we appreciate the extra safety since real user data has been cloned to the full sandbox).
I have APEX code that sends single email messages to administrators (notify that a job is done, etc). This of course throws this error:
NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile.
I'll probably end up wrapping this in a try/catch to eat the error gracefully, but I wonder if there is a way to detect the System Email Only setting in code?
I had hoped that Limits.getLimitEmailInvocations()
would return 0
in my sandbox but it returns 10
.