Exerra's profile picture

17 May 2023 ~ 1 min read

How to reply to an email in code

Email replies are an essential part of the email experience, and if you are building a service that requires the sending of email replies (for any reason), keep reading!

Each email sent contains headers with information about return paths, authentication results, provider info, signatures, subject, content type and etc. For replies, the ones you should care about are the headers Message-Id and References. These provide references for email providers, in order to let them determine to which email you are replying.

To make your email a reply, just return a References header with the value of the References header of the email you're replying to and the Message-Id header at the end, alongside a In-Reply-To header with the value of the Message-Id header.

Exerra's avatar

Hi, I'm Exerra. I'm a full-stack developer from Latvia . You can follow me on Twitter, see some of my work on GitHub, or read more about me on my website.