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
nagalakshminagalakshmi 

SendEmail failed. First exception on row 0; first error: UNVERIFIED_SENDER_ADDRESS, Organization-Wide Email Address has not be verified for use

Hi,

I am getting the error as'SendEmail failed. First exception on row 0; first error: UNVERIFIED_SENDER_ADDRESS, Organization-Wide Email Address has not be verified for use' from the test class. 

I have given the verified Organization-Wide Email Addresses to fromaddress field. Still i am facing the issue. Please let me know how can i solve the issue,

Thanks,
lakshmi.
Sameer Tyagi SFDCSameer Tyagi SFDC
Hi Lakshmi, 

You need to use any verfied address in your test class like this . 
 
list<OrgWideEmailAddress >   owdlist = [SELECT Id FROM OrgWideEmailAddress limit 1]
//Now use this id in your email message code

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setOrgWideEmailAddressId(owdlist[0].id);

Thanks & Regards,
Sameer Tyagi
http://mirketa.com/

 
sagarvp9sagarvp9
When you define a Organization-Wide Email Address in your SFDC Org, the Email-Id which you provide will recieve an email notification from Salesforce for verification, this should be verified else you will end up getting UNVERIFIED_SENDER_ADDRESS exception when used in the Apex Code to send Email using SingleEmailMessage class.