function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LaurentDelcLaurentDelc 

NO_MASS_MAIL_PERMISSION hiding the real cause of the problem?

Hi everyone,

 

i have a very dodgy situation.

I get 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.

When I use this:

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
listEmail.add(mail);
Messaging.sendEmailResult[] results = Messaging.sendEmail(listEmail);

 

 

- The Profile has the email enable(it is by default anyway that's why so few people gets this error)

- I tried the template test feature and it works perfectly with the same Email template

- Even better! I tried to send an email from another part of our system and it worked!

 

My conclusion is this NO_MASS_MAIL_PERMISSION is actually hiding the real cause of the problem.

But now, what do I do?

Any suggestion?

 

Thanks

Laurent

 

Best Answer chosen by Admin (Salesforce Developers) 
LaurentDelcLaurentDelc

Alright I found it!

It's because the user who tries to send the email cannot access the Contact, which is mandatory to use the sendMail (one of the worst decision of salesforce, legacy probably)

It is linked to this problem:

 

http://community.salesforce.com/t5/Security/No-access-to-an-object-JUST-after-creating-it/m-p/181952#M135

 

Cheers,

 

Laurent

 

All Answers

LaurentDelcLaurentDelc

Anybody?

I'm really blocked on this one.

 

Laurent

atormanatorman

Just to clarify, does the profile have the 'Send Email' permission enabled and/or the 'Mass Email' permission enabled? Your posting only mentioned one permission.

 

 

LaurentDelcLaurentDelc

Yes it does. 

Anyway we are not using mass email so it shouldn't be a problem.

LaurentDelcLaurentDelc

Alright I found it!

It's because the user who tries to send the email cannot access the Contact, which is mandatory to use the sendMail (one of the worst decision of salesforce, legacy probably)

It is linked to this problem:

 

http://community.salesforce.com/t5/Security/No-access-to-an-object-JUST-after-creating-it/m-p/181952#M135

 

Cheers,

 

Laurent

 

This was selected as the best answer