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
chirugantachiruganta 

Problem with sending email from organization wide email address.

Hi,

I have verified an email in organization wide email address and sending email from apex class. This is working fine. But for one user it is throwing following exception,


System.EmailException: SendEmail failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_OR_READONLY, Not profiled to access this Org-wide Email Address: []

 
Ravi Dutt SharmaRavi Dutt Sharma
On user profile, check "Send Email" checkbox.
Let me know if this helps.
KaranrajKaranraj
Make sure that you have enabled user profile in the org-wide email address to use it as From email address.
  • Go to > Setup > Email Administration > Org-wide default
  • Click edit to the Org-wide email address, if you selected "Allow Only Selected Profiles to Use the From Address" then make sure that the user profile is included in the list
chirugantachiruganta
Hi Ravi / Karanraj,

I have added Send Email permission and added profiles in org-wide default. But it is not working.
 
Ravi Dutt SharmaRavi Dutt Sharma
Navigate to Setup > Email Administration > Deliverability to update the Access Level to All Email.
chirugantachiruganta
Hi Ravi,

In my org it is already configured to All Email
jameskCAjameskCA
I just ran into this today, and adding the users profile to the allowed profile fixed it.  What I don't understand is, if it's trying to send the email from Apex, why does the user need permission?  I thought apex code was run as system profile? 
Kirill_YunussovKirill_Yunussov
@Jim, yes I agree, it should allow anyone to use it via apex.  Yet another unnecessary hoop we have to jump through.