2

I'm currently trying to design a PHP webapp that allows users to send emails to other users. The recipient can then reply to the email and the message will be updated in the webapp.

Now to keep track of each individual user message, I would like to add a custom header (ie. conversation_id) in the email. When the recipient replies to the email in their email client, will the custom mail header (ie. conversation_id) be preserved?

There will be cron job that executes every minute that opens a POP3 stream to the web server to retrieve new emails (replies that the user may have sent with their mail client) to update my DB.

I'm not sure if this is a good way for designing such an app. Any suggestions?

EDIT: Also, I'm sure wondering how I can strip out the quoted messages in the reply?

  • 1
    Bringing to topic back from the dead: has anyone figured out which header (or reference) can survive reply by Gmail and MS-Outlook If yes, any thoughts about future-proofing this? – user13708028 Jun 26 '22 at 04:33
  • I am also looking for an ans. We want to sent certain keys in the send email. which we will expect to come back in the reply sent by the recipients. I tried settings values in header but its not being sent back in the reply email coming back from gmail client. – A_01 Jan 05 '23 at 05:29

2 Answers2

4

You can't rely on mail headers being preserved - it is pretty much up to the individual mail client to decide what to include.

I would generally put the conversation ID within [] brackets in the subject which makes it really easy to parse out with a regular expression.

christophmccann
  • 4,181
  • 7
  • 42
  • 66
  • You can also put the ID in the message body. It can be changed/deleted (unless you use include signature of id or just embed encrypted id) of course but depends on your rules of communication. May be require users not to delete subject or keep original message in reply... These are some ideas which may work for your solution. – kind_robot Mar 12 '15 at 13:38
  • Bringing to topic back from the dead: has anyone figured out which header (or reference) can survive reply by Gmail and MS-Outlook If yes, any thoughts about future-proofing this? – user13708028 Jun 26 '22 at 04:33
  • @user13708028 : You can use header "References". This will always be the same even if the reply has changed subject. How I did is : First created draft to generate this references id. We keep it in db. Every reply contains same id in References header. – A_01 Jan 11 '23 at 14:26
0

Each message already contains the Message-ID field which is used by the mail clients to create the content of the In-Reply-To field.

Wouldn't the usual way after the standards be to rely on the user's mail client setting the in-reply-to field correctly? As far as I know, all email client use this correctly. (even though according to this thread Outlook may have an occasional bug?)

So I think, emails already feature this and you don't have to worry about creating a custom mail header entry and unpredictably behaving mail clients.

EDIT: I rembember a friend telling me his frustration from work about how many people remove or even edit these Tags in [ ] brackets from the suject field. Also, it seems to be a very dirty work-around and all of your software would need to handle it without opposing it to the users ability to change it => practically impossible.

EDIT: I think it will be hard to reliably strip out the quoted message in the reply, because each mail client handles it differently.

Ilka
  • 50
  • 8
  • Bringing to topic back from the dead: has anyone figured out which header (or reference) can survive reply by Gmail and MS-Outlook If yes, any thoughts about future-proofing this? – user13708028 Jun 26 '22 at 04:32