+ Start a Discussion
Rocio VivancoRocio Vivanco 

Inbound email

Hi all,

by using inbound email handler and email services where do inbound/incoming emails go in Salesforce, for example for Cases? do they go the related list Emails?
Abhishek M.Abhishek M.
Hi Racio,
Inbound email are processed by the Email Service apex class defined by you in your org.
If Email Service apex class is not defined, the Salesforce simply discards that email as their is no logic/class to process that email.

- Hope this helps.
Rocio VivancoRocio Vivanco
Hi Abhishek,

thanks for responding. Ok, I see, but that means you can define where your incoming emails go (which related list) in that Email Service apex class, right?. As I am not a developer I would like to understand how this works.
The object case has a related list which is Emails, when you use Email To Case, all outbound and inbound emails can go to this related list. But this is standard in Salesforce as soon you define an Email Service.

The whole requirement is:
When you go to a case and try to create a new email (Emails related list), you have to do two steps:

1. Create an email
2. What you see is that the "To" field is automatically filled with the Contact name. And when you open the lookup "To" it shows all contacts.

We were thinking of creating a custom field, a lookup to Contacts, say, "Internal partner" and be able to filter it to only the contacts who are internal partners in the company.

Once you choose an internal partner in that lookup, an email has to go to that contact (this is possible, I know, via Workflow and email alert for example). But, what happens when this contact answers? the answer should go to Salesforce, be registered in that case and so on, if Customer Service sends an email back to this contact, the outbound message should be registered in Salesforce for the same case as well.

We would like to achieve this but we don't know exactly how.

I would appreciate any help.
 
Abhishek M.Abhishek M.
Hi Racio,
When the contact asnwers i.e. he/she replies to email, you can have an apex class i.e. Email Service which will retrieve the case information from the email subject, body, sender,etc.
So you will know from where you got that email and accordingly you can assign the email to the case.
To assign the email to the case, in apex class you have to give ParentId i.e. Id of the object to which this email will be attached.
Also, when you activate the Email Service, Salesforce provide you with an email unique to your org like as follows,
document_testcriteria_xyz@w-1pdfsimdmfdfaczndsznzh7pmithiej85boaeyudvddfdfdsfdfdfvd1pgxcy3.o-550f1maa.cs5.apddsd.sandbox.salesforce.com

FYI, Salesforce may have provided some out-of-the-box functionality for your requirement as it an general requirement, I am not sure of that, need to explore.

- Hope this helps.