Search code examples
emailsmtpgmailemail-headerspostmark

How to set A Persistent header variable across email thread


I need a persisted variable(not necessarily on the headers) that can be carry over to an email thread.

Using Postmark as SMTP. and set headers like the following:

  client.sendEmail({
     "From":"[email protected]",
     "To": {...},
     "Subject": {...},
     "TextBody": {...},
     "Attachments": {...},
     "Headers": [
         {
           "Name": "X-CUSTOMNAME",
           "Value": <CUSTOMENAMEID>
         }
    ]
  },

Gmail receives gets the custom header. but when I reply to the email. It does not get carried over.


Solution

  • I have been trying to find a solution for this also. At the moment I only have a work around. I set a hidden element. and when a user replies to the email. assuming he does not delete the "history" or the contents of the original email. I parse that span and get the ID or value that I set in it.

    This is my sample

    <span id="whatEverYouWantToPass"> </span>