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
RajivRajiv 

Capture Email Responses automatically in Custom object Salesforce

Hello Guys,

I need to capture email reply in Salesforce. For example let's take a scenario I have sent an email to one contact from send an email button from the custom object activity history related list. As soon as I send the mail, Contact will receive mail in his outlook or mailbox . If the contact try to reply over the mail from outlook or gmail then will Salesforce capture this reply automatically? If not how can I achieve this and capture automatically reply ? Please suggest. Thanks.

Regards,
Rajiv
Anuj PatelAnuj Patel
Hi Rajiv, 

You do not need any custom object to handle the particular issue. Salesforce have an object called InboundEmail that stores incoming email contets and attachement. You can configure everything using email services. I have attached two links that will help you to get more details about Apex Email Services and the object.
Email Services
https://developer.salesforce.com/page/An_Introduction_To_Email_Services_on_Force.com
InboundEmail
https://help.salesforce.com/HTViewHelpDoc?id=code_inbound_email.htm&language=en_US

Please feel free to ask anymore questions you have, 

Please mark it as the best answer if you find it useful.

Thanks,
Anuj.
 
RajivRajiv
Thanks Anuj for your reply. I know about the inbound email, in this a link gets generated and when you sent an email to that link then it will invoke the apex class and capture the email content. The only problem i am facing is that when we sent an email from the activty history the "TO" address takes personal email id of the logged in User, can we set "To" address to the generated email address by inbound email?Otherwise email replies will always goes to their personal email id instead of Salesforce. User won't change "TO" address to the inbound email address themselve, it should be automatic.
Anuj PatelAnuj Patel
Hi Rajiv,

One thing I can suggest is, if we store the email address from incoming email on the same record of InboundEmail. You can add that email address in the email header adn create a custome email header of your choice.
The only reason I have used the word suggested is, I never used it before. So, Please share your findings when you find anything about it. 

 
Please mark it as the best answer if you find it useful.

Thanks,
Anuj.
 
Mark Jones 56Mark Jones 56
Hi Anuj,

Is it possible to report on the number of email replies?

Thanks,

Mark
Ragula SivakumarRagula Sivakumar
Hi @Rajiv,

Did you find anything on this??
If yes could you please post some references.

 
Nishith Cheemakurthi 16Nishith Cheemakurthi 16
Hi Rajiv,

I suggest you to create a dedicated Email for this as purpose. Ex: contactMessager@yourdomain.com and add this email to your Organisation-Wide-Addresses

Once you have done it create a Apex Email Service then you receive a random Salesforce email Ex: randomtext@salesforce.com

In your dedicated Email, enable email forwarding to the salesforce Email.

While sending an email, send it only through the dedicated email. If a user responds to the email, capture the in-reply-to data in the inboundEmail and query the email instance of the mail you have sent along with the relatedTo field.

Finally using above information, update the newly received EmailMessage.

Let me know if you have any queries for the above solution

Regards,
Nishith