0

I have created an email service and apex class that converts incoming email into tasks and associates them with the matching record. the idea is to simulate email to case functionality.

it works as follows---

  • Email is sent from a custom button on a custom object.
  • The button Url populates the outgoing email from address as the email service address.
  • Reply emails are sent to the email service address.
  • The apex class associated with the email service creates a task from the incoming email and attaches it to the associated record.

This is working fine.

The problem is, in order for the outgoing email to be seen as coming from the email service address, the email service address needs to be set as an Org Wide email address and needs to be verified.

I have set it as the org wide email address but I cannot verify it as the verification email is never received. When not verified, the email from address appears as the logged in user by default.

I need to know how to verify the org wide default address when it is set as the email service address.

3 Answers 3

3

I had this problem - my solution was to write something in the handler that will create a task for the verification email that gets sent to that email handler address when you verify the org wide email - that way, you can see the link, click it and the email address is then verified. You only need to it once, so maybe have some logic that says if no object record is found, just create a task with the email text...

1

You can also switch on debug and see the verification link in the debug log.

0

Faced a similar problem, I had to add this piece of code to inbound handler

//Added the below code to add Email Service address as Organization Wide Address
        if(email.fromAddress == '[email protected]'){
                
                Task newEmailTask = new Task();
                newEmailTask.Description =  email.plainTextBody;
                newEmailTask.Priority = 'Normal';
                newEmailTask.Status = 'Not Started';
                newEmailTask.Subject = email.subject;
                insert newEmailTask;
            }

This creates a task when verification email is sent on adding email service address as org wide address. Please go to the task created and click on that link. You should now see that the org wide address is verified.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .