I have got an email address after creating an email service in Salesforce. Now I want to add the email address which I got from email service in "Organisation-Wide-Email addresses" and verify them. I have added the email address in organization wide address but how can I verify it?
Ahhh you can try one hack which I have used when I face similar issue. In your email service handler class create any test record and save the email body.
Now send the verification email and your class will create the record. Now from the body of record you will get the verification link and Now you can easily verify the email.
There are various ways you can do it. Our main motto is to make our code in such a way via which we will be able to do it in LIVE and sandbox without much hassle.
- Use of Hierarchical custom settings having a boolean field.
- Modify your apex class in such a way to use the custom setting field. If the field's value is true, insert a dummy record or forward a mail to your address.
- If custom settings value is false, do your normal email service operation.
By this your Class once created will have the power to be attached to multiple email services and you can easily verify the, using custom settings as a switch which is quite useful if you want seamless integration in UAT LIVE or multiple sandboxes.