Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

phpMick's avatar
Level 15

Relating email replies to original email (e-mail thread).

Not sure how to start with this.

I'm sending e-mails with Sendgrid. When the recipients reply to the mails, Sendgrid will parse the reply and POST to my webhook.

How can I relate the reply to the original message, so that I have a message thread?

I'm thinking that this may be possible using X-SMTPAPI headers and unique_args.

Mick

0 likes
5 replies
Snapey's avatar

most commonly with this sort of thing (like help desk tickets) there will be a token somewhere in the email body. I assume there are no better options if people like zendesk can't manage it?

phpMick's avatar
Level 15

Looking at Zendesk, I can see a message id

(Message-ID: <[email protected]>)

there is also an id in the reply to address

<support+id4929167@twiliosendgrid.zendesk.com

also maybe this is a token in the body:

[OLK3ZZ-Y0D5]

It has been suggested to me to use the reply to address. I just wondered if this was the best way.

Mick

Snapey's avatar

I suppose you can use a + in the replyto address, like support+6D7HGGz42@mydomain.com

It should be passed along to the support inbox

phpMick's avatar
Level 15

Yeah, I'm just trying to do some research, before I start doing that.

Please or to participate in this conversation.