I need to create a system to allow customers to submit documents for approval automatically. The design is:
- A button on the lead/contact page to send a request for a document.
- That buttons sends an email asking the user to reply directly with their attachment, with the Reply-To header set to the address of the inbound email service*.
- At the same time, the Message-ID header is saved** on the lead/contact.
- When the lead replies, their email client automatically sets the reply to field to the inbound email service address due to the header.
- The reply email arrives at the inbound email service and if the Message-ID*** header matches one saved on a lead, the attachments are processed and attached to that lead.
I have run in to two problems and a query here though:
1 - * - How do I get the address of the inbound email service in Apex? I can't hard code it because as soon as I deploy from a sandbox to a live environment the address will need to be changed.
2 - ** - How do I retrieve the Message-ID header? I know how to do this when working with an inbound email, but can't find any way to do it for an outbound one.
3 - *** - Does anyone know off-hand whether a Message-ID header will stay the same in a reply? I heard it would because that's how email clients group threads together.
If the answer to any of my questions is "it can't be done", what alternatives do I have?