# Extract all email headers from an eml file?

**URL:** https://discourse.nodered.org/t/extract-all-email-headers-from-an-eml-file/46949
**Category:** General
**Created:** [9 June 2021 22:36 UTC](https://discourse.nodered.org/t/extract-all-email-headers-from-an-eml-file/46949 "2021-06-09T22:36:01Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)
#### Post date: [9 June 2021 22:36 UTC](https://discourse.nodered.org/t/extract-all-email-headers-from-an-eml-file/46949/1 "2021-06-09T22:36:01Z")

</div>

Hello.  
I need to extract all e-mail headers from a eml file and write them in a separate file  
I have seen mailparser contrib but it doesn't work  
does someone know how can I perform this action in node red?

Thank you.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [9 June 2021 22:45 UTC](https://discourse.nodered.org/t/extract-all-email-headers-from-an-eml-file/46949/2 "2021-06-09T22:45:53Z")

</div>

A quick Internet search showed up plenty of articles about the structure of a .eml file. It appears to be mainly text-based I think so you should be able to dump it to debug and then start to look at the structure and work out where to split it.

---

<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: [9 June 2021 22:48 UTC](https://discourse.nodered.org/t/extract-all-email-headers-from-an-eml-file/46949/3 "2021-06-09T22:48:55Z")

</div>

You may be able to use [eml-parser - npm](https://www.npmjs.com/package/eml-parser) if installed and called from a function node as it looks fairly recent

---

<div class="post-metadata">

### Author: ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)
#### Post date: [10 June 2021 09:43 UTC](https://discourse.nodered.org/t/extract-all-email-headers-from-an-eml-file/46949/4 "2021-06-10T09:43:14Z")

</div>

Sounds really good.  
perhaps the issue is that I have nodered in docker and it is not easy to install packages inside it.  
I will open a new thread to ask it.

Thank you

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [11 June 2021 15:54 UTC](https://discourse.nodered.org/t/extract-all-email-headers-from-an-eml-file/46949/5 "2021-06-11T15:54:01Z")

</div>

> [@crester](#):
>
> docker

Hmm, but then that isn't a Node-RED issue is it? 😀

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [10 August 2021 15:54 UTC](https://discourse.nodered.org/t/extract-all-email-headers-from-an-eml-file/46949/6 "2021-08-10T15:54:25Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
