2

I'm trying using setOrgWideEmailAddressId in my class Apex but he return this error: 718403274-125341 (195485361)

Code:

@AuraEnabled
    public static void sendEmailReference(String strEmail){
    OrgWideEmailAddress orgAddress = [SELECT Id, Address, DisplayName FROM 
    OrgWideEmailAddress WHERE DisplayName = 'Atendimento'];
    Messaging.reserveSingleEmailCapacity(1);
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    mail.setOrgWideEmailAddressId(orgAddress.Id);
    String[] toAddresses = new String[] {strEmail}; 
    mail.setToAddresses(toAddresses);
    mail.setBccSender(false);
    mail.setUseSignature(false);
    String htmlBody = 'hello';
    mail.setHtmlBody(htmlBody);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }

What can it be?

4
  • Have you verified the Org WIde email address in setup? also is the running profile has access to that org wide address Mar 27 '19 at 13:04
  • 1
    Thank you guys, Pranay it's worked for me, someone deselected "Allow All Profiles to Use this From Address" in Organization-Wide Email Addresses, thank you very much Mar 27 '19 at 13:10
  • 1
    @PranayJaiswal Please post an answer so the OP can accept and properly close this question. :)
    – Adrian Larson
    Mar 27 '19 at 13:59
0

If one tries to send email using OrgWideEmailAddress and does not have profile access, one gets a gack.

Fix: Add that profile to OrgWideEmailAddress supported profile list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.