[SalesForce] How to query for email addresses listed under Email-To-Case routing addresses

Use Case
I am replacing the standard Email publisher action on case with a custom VF page using the apex:emailPubilsher tag. For certain cases, we need to be able to include an extra "From" address as an option.

Problem
The problem is when you specify the "fromAddresses" option in the emailPublisher tag, it replaces the entire list with what is supplied. I don't want to replace the list, just append a value to it.

TLDR
I am looking for a way to query for the email addresses listed under the Routing Address section of the Email-To-Case Settings page. Specifically those listed as Email2Case.

What I've tried
I know the OrgWideEmailAddress object is not what I'm looking for here. I did find a CaseSettings description but it doesn't seem like I can access that from within SFDC.

Any help would be appreciated. Thanks!

Best Answer

You can query the case-to-email address using the EmailServicesAddress object.

SELECT Id,AuthorizedSenders,EmailDomainName,IsActive,LocalPart FROM EmailServicesAddress

The LocalPart plus the EmailDomainName make up the routing email address.

Reference: