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
RadnipRadnip 

Using mail.setOrgWideEmailAddressId requires authorisation.

I'm trying to do the following in Salesforce Sites:

 

            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[] {opp.Owner.Email};
            mail.setToAddresses(toAddresses);
            mail.setOrgWideEmailAddressId('0S2B00000008OXA');

But whenever I use/set the setOrgWiseEmailAddressId Salesforce sites says that I need authorisation. I just want to change the from address in the email. Can you use organisational wide email addresses in Salesforce Sites?

WorkhardWorkhard

Hi,

I have used this for sites also and its working. I think you are geting this error because the email which you are geting through the query is not authorized. Please check that email status inside Organization-Wide Email Address(Setup->AdminSetup->EmailAdministration->Organization-Wide Email Address) that it is verified or not??????

 

 

Think this will help you.

hemantgarghemantgarg

Yes, its right, org wide email address must be verified before use .

RadnipRadnip

Yes it was verified but still didn't seem to work :(

Ramesh SomalagariRamesh Somalagari
Hi all,I have same issue some one can help me http://salesforce.stackexchange.com/questions/47271/how-to-override-the-from-email-in-messaging-singleemailmessage