+ Start a Discussion
Radhe Shyam.Radhe Shyam. 

Organization-Wide Email Addresses Verification

Hi All,
How to verify the email address generated by Email Services.
My Address is :

And i am trying to verify this by writing code:

global class EmailVarification2 implements Messaging.InboundEmailHandler{
global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
System.debug('Sent Mail');
Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
String[] sendingTo = new String[]{'rxxxxxx@gmail.com'};
 for(OrgWideEmailAddress owa : [select id, Address, DisplayName from OrgWideEmailAddress]) 
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail});
Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();

return result;

User-added image

I am not getting any email on mentioned email id: rxxxxx@gmail.com -Please guide
Sergio Alcocer 5Sergio Alcocer 5
Hello Radhe, 

First I would like to remind you that it is way easier to read code if you put it using the Code formatting.

Going back to the topic, in order to use and Org-Wide Email Address, it needs to be validated first. Salesforce does so by sending an email to the address to confirm it.

Your approach is to create an Email Service to forward that e-mail to your gmail account BUT I see a couple of odd things there.
  1. Your are not taking the body of the inbound e-mail, just the subject
  2. You might be trying to use a OrgWideEmailAddress that is not yet verified, which might be preventing SF from sending the e-mail

And just as pure curiosity, what is the business need of having that odd e-mail address? Usually, what is done is to create a customer-friendly email address (e.g. contact@your-company.com) and create a rule / filter that forwards internally all to the huge-odd-ugly salesforce email. And for replies, you can also use that address as org-wide to reply back the customers.

If this helps you and can be considered as a solution, please mark is as such so future users can go to it directly.
Otherwise, reply and I'll try to help you out a bit more ;)