I have a class containing this method that creates an email in APEX and sends it out once the method is called.

public static void generateMessagingTemplates( String requestLogId){

        String siteUrlStatic = String.valueOf(System.Label.gos_Site_URL);
        Site negCon = [SELECT id, UrlPathPrefix FROM .....];
        List <Messaging.SingleEmailMessage> allTempates = new List<Messaging.SingleEmailMessage>();

        for (Integration_Request_Log_Item__c eachLogItem : [SELECT Id,...]){

            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[] {eachLogItem.Email__c}; 
            mail.setSenderDisplayName('Salesforce Support');
            mail.setSubject('Testing ......');
            mail.setPlainTextBody('Something something ...');
            mail.setHtmlBody('<p>Dear (Sir / Madam),<br /><br /></p>');

        //System.debug('allTempates >> '+allTempates );
        Messaging.sendEmail( allTempates );

I have tested it as myself (an Admin in Dev console, execute anonymous) and it works, emails are being sent to the email I specify. Now the problem is with Community users.

I have a test users in our community, with Community User Plus license type. When I login as any of those users into the community and trigger the actions that invoke this class, emails are not being sent. I know for the fact that the class is called out by the community users, because another part of it is creating/updating some records, and that is happening. But email part is not. I also monitored the email log and nothing hit that either.

Any ideas why this might be happening? Is there some permission those community users are missing? Please, any insight will be appreciated.

  • Did you check debug logs for any errors?
    – RedDevil
    May 15, 2019 at 4:16
  • Nothing in the logs. Also I do not think that logs for Community users show us, and I was not able to set one manually
    – Art S
    May 15, 2019 at 4:36
  • 1
    logs can be set for community users or else try the other way around , enable logging for the apex class from which you are sending emails and see what happens
    – RedDevil
    May 15, 2019 at 4:37
  • Check 'Send Email' Permission in General User Permissions section in portal profile. May 15, 2019 at 9:35
  • I figured it out. Was able to create a log for the Community user. There is a hardcoded value in my class that I missed and as a result one if my queries was returning null.
    – Art S
    May 15, 2019 at 14:50

1 Answer 1


Customer Community user can not send email, even though send email limit is consumed, as and when system encounters a community user sending the email, it will not be sent to the recipient.


  • What makes you think this was a Customer Community user? Reading the last comment to the question, it appears that the asking person finally found a solution and was able to send emails. Oct 13, 2022 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .