I am sending one email to two address [email protected] and [email protected] and both the address are on TO section. for both the address email 2case has been setup. Salesforce is creating two cases. Is there any way to track the email address for which the case got created.
Let's say, Email-to-Case set up is like this:
Though for both the Email Messages Parent Ids are different.
I could find querying
Headers from EmailMessage
SELECT Id,ToAddress, ParentId, Headers FROM EmailMessage WHERE Id = '02s7A000008rq3L'
In the Header, search for X-SFDC-Original-RCPT, it shows that particular email address which has been mentioned as
Email Services Addressfor which this case is getting created.