I'm building a PHP app which should somehow receive emails that are to be imported into user records. None of the solutions I've come up with will work (listed and explained below). I'm hoping someone out there has a possible solution.
Our organization's email is hosted by Google, and so I can use the Google API to access the mail account.
The intended workflow is:
- Client emails a central email address that people access through delegation.
- An Agent does some action that indicates the email thread should be associated with the Client's account in the app.
- The app is somehow informed that a particular email is to be imported, and does so.
I've tried a number of solutions:
Initially the app had a simple read-only re-creation of the inbox. This re-creation allowed the Agents to associate a particular email with any account in the app with a click of a button and filling out a modal form. This method proved less than ideal however, as Agents typically had to respond or file the email - for which they had to go back into GMail.
We had also thought of making a new MX record and server so Agents could simply forward the email to
[client's ID]@app.mydomain.com. This was denied by management though as maintaining an email server is a lot of work.
Next up was having the Agent forward the email to
[client's ID]@app.mydomain.com. Even though app.mydomain.com doesn't exist, the app could check the
firstname.lastname@example.org, and parse who else the email was sent to. However this caused a bunch of "Email not sent" messages from Google.
Finally I thought we could have the agents forward the email to
email@example.com, and include in the body some special key that the app would look for. Typically this sort of thing is put into the subject and looks like
[REF:12588F3T6YYB]. Our special key would look like
[appname:client-id,other-client-id,etc]. Right now it looks like this is the best solution. I tried to build a GMail Add-On that would simplify this process, but Add-ons can't be run when the account is accessed through delegation.
Is there a magic 5th option that will be easy for our Agents to use?