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
yurybondyurybond 

How to check if Org-Wide email is verified

I asked this question here http://boards.developerforce.com/t5/Apex-Code-Development/get-the-Org-Wide-Address-ID/td-p/260145

but nobody helps me.

 

So, how to check if Org-Wide Email Address is verified?

 

thanx,

Yury

aalbertaalbert

When you initially set up the org-wide email, it sends a verification email to the email address. There is a link in the email sent to the org-wide email address, that once clicked, verifies the address. Then, to double-check, the Admin can login to salesforce.com, and under Setup | Administration Setup | Email Administration | Org Wide Email Addresses, the status will be set to "Verified." 

yurybondyurybond

thank you for the advice,

but I'd like to check verification status in apex code.

something like this:



Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
OrgWideEmailAddress owa = [SELECT Id, Address FROM OrgWideEmailAddress];

//if owa is not verified Messaging.sendEmail method throw exception
//so we need to check verification status before sending

mail.setOrgWideEmailAddressId(owa.id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

//HOW?
//Maybe owa.isVerified; or owa.isVerified();

 

tnx