# Use reply headers for email threading

**URL:** <https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364>\
**Category:** Feature Requests\
**Created:** [21 May 2019 12:35 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364 "2019-05-21T12:35:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![domenzain](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/domenzain/32/8554_2.png) [@domenzain](https://discourse.nodered.org/u/domenzain)\
**Post date:** [21 May 2019 12:35 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364/1 "2019-05-21T12:35:46Z")

</div>

Currently it is possible to have e-mails as inputs or outputs of flows.

Some headers can be set directly, like `To` and `CC`, but not all: specifically, `In-Reply-To` and `References` should be updated for email threading to work as expected.

This would allow for flows where an email by Node-RED can be clearly marked as a reply to the email that initially triggered the flow.

An easy way of implementing this is to add those fields to the existing `nodemailer` interface, as it implements them already.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 May 2019 13:20 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364/2 "2019-05-21T13:20:42Z")

</div>

great - we look forwards to the pull request.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 May 2019 15:57 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364/3 "2019-05-21T15:57:44Z")

</div>

Great - that was quick 🙂

> <https://github.com/node-red/node-red-nodes/pull/542>

---

<div class="post-metadata">

**Author:** ![domenzain](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/domenzain/32/8554_2.png) [@domenzain](https://discourse.nodered.org/u/domenzain)\
**Post date:** [21 May 2019 16:39 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364/4 "2019-05-21T16:39:48Z")

</div>

There wasn't much work to do!  
I hope it is useful to others too.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 May 2019 16:40 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364/5 "2019-05-21T16:40:53Z")

</div>

I assume you have tested it and are happy with it now ?

---

<div class="post-metadata">

**Author:** ![domenzain](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/domenzain/32/8554_2.png) [@domenzain](https://discourse.nodered.org/u/domenzain)\
**Post date:** [21 May 2019 18:05 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364/6 "2019-05-21T18:05:34Z")

</div>

Yes!

The messages correctly thread after setting these headers to the `Message-Id` of the original message. And setting the subject to `"Re: [original subject]"`.

It was really just propagating the headers to the underlying library.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [22 May 2019 07:42 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364/7 "2019-05-22T07:42:52Z")

</div>

Now on npm as v1.5.0

---

<div class="post-metadata">

**Author:** ![domenzain](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/domenzain/32/8554_2.png) [@domenzain](https://discourse.nodered.org/u/domenzain)\
**Post date:** [22 May 2019 15:37 UTC](https://discourse.nodered.org/t/use-reply-headers-for-email-threading/11364/8 "2019-05-22T15:37:34Z")

</div>

The version bump to 1.5.0 changes the dependency `mailparser-mit` to `mailparser`. This works if `mailparser-mit` happens to be installed but fails otherwise.

> <https://github.com/node-red/node-red-nodes/pull/544>
