Salesforce: Sending emails from communities doesn’t work

I’ve been doing a lot of work with Communities AKA Experience Sites recently and encountered an issue where emails sent using the Apex method Messaging.sendEmail() were not be received by the recipient. The strange thing was that the debug logs showed that the email had been successfully sent, and the associated Activity record had been created.

SendEmailResult emailResult = Messaging.sendEmail(LIST_OF_EMAILS);
System.debug(emailResult); // isSuccess = true

And thus began many hours of debugging to understand the root cause and its fix. I tried the usual suspects:

  1. Is the email address correct and valid?
  2. Is the email going to spam?
  3. Does the user have permission to send emails at the profile or permission set level? (e.g. “Send Email”)
  4. Does the user have profile or permission set access to the required classes (used to send the email), objects, and fields (used in the classes that send the email)?
  5. Is the user’s community profile assigned to the Community?
  6. Is email deliverability (Setup > Email > Deliverability) set to “All Email” and “Enable compliance with standard email security mechanisms” checked?

None of the above worked. When I checked the Email Logs there was still no entry for the email despite the Apex code saying it had successfully gone out. Then I came across an article in the Winter ’24 release notes saying the email addresses must be verified to send emails through Salesforce. Aha! Or so I thought.

For standard Salesforce users, you’ll see “[Verified]” next to their email address. Or, if they’re not verified there’ll be a link to verify them. This is not the case for community users. No “[Verified]” text, or a link to perform the verification. And even if this setting is checked:

No email confirmations are sent (at least in sandboxes or dev environments) when email addresses change. With no indication of whether the user was verified and no explicit way to do so, I simply reset their password. When I checked the Setup Audit Trail I saw an entry saying that the email address had been verified! And that my friends, fixed my issue.

Leave a Comment