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

How can an email handler discover which email address is its own?

If a single email hander is used for multiple email services, and if the address can be either in the to, cc, or bcc, how can the handler tell which was the address that resulted in it receiving the message?


If two email address are both formatted '' that may not be enough to know which *mine* is.


Is there a field in the inbound object that identifies which address is mine?


Why am I interested?


Our system can create an outbound email and we want to record that it was a) successfully sent and more importantly that b) it was delivered.  We want to chatter the reception, but need to communication which ID to post to.


We thought we could use the "info <an-email-address>" format.  We can find this information in the email headers, but want to be more discriminating and make sure we pick-out the right one.  If we knew our email address (which changes on every org) then we could find the right inbound.header and extract the target id from it.


Tom --


I don't know the answer to your question as I've only created multiple email services, one per use case.  One thing to consider is with multiple email services you can have a different context user so when database updates are made, you can see which email service did the update.


Also,  you can use custom settings to keep track of email service addresses that vary by org


I thought about the custom settings, but I was hoping to keep administration/setup to a minimum.  My previous email settings have all been more straightforward because what I did with the email had more to do with who sent it than who received it.  


Maybe I'll do some other encoding of the bcc line to indentify which record I'm looking for.  


If I come up with something clever, or nearly so, I'll post it here.