# Save email as file

**URL:** <https://discourse.nodered.org/t/save-email-as-file/77848>\
**Category:** General\
**Created:** [23 April 2023 14:33 UTC](https://discourse.nodered.org/t/save-email-as-file/77848 "2023-04-23T14:33:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vi-rgaigl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vi-rgaigl/32/51869_2.png) [@vi-rgaigl](https://discourse.nodered.org/u/vi-rgaigl)\
**Post date:** [23 April 2023 14:33 UTC](https://discourse.nodered.org/t/save-email-as-file/77848/1 "2023-04-23T14:33:41Z")

</div>

I am looking for a way to save an Outlook email (.msg format) as a complete original file in a folder.  
Has anyone already found a solution?  
I would be very grateful for any information or help.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 April 2023 14:43 UTC](https://discourse.nodered.org/t/save-email-as-file/77848/2 "2023-04-23T14:43:43Z")

</div>

Use a `file` node to write the email it to file system in the "folder" specified with a suitable filename "an-email.msg"

Of course this assumes you already have the `email` and it is in `msg.payload` - you didnt state!

---

<div class="post-metadata">

**Author:** ![vi-rgaigl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vi-rgaigl/32/51869_2.png) [@vi-rgaigl](https://discourse.nodered.org/u/vi-rgaigl)\
**Post date:** [23 April 2023 15:05 UTC](https://discourse.nodered.org/t/save-email-as-file/77848/3 "2023-04-23T15:05:49Z")

</div>

The problem is that the 'node-red-node-email' node splits the incoming email into objects (header, html, from, attachments, ...) and thus the email as such is not loaded into msg.payload. msg.payload ist _'undefined'_

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [23 April 2023 16:30 UTC](https://discourse.nodered.org/t/save-email-as-file/77848/4 "2023-04-23T16:30:23Z")

</div>

Why don't you use a `change` node to put the parts into the payload as you would like the to be.

---

<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:** [22 June 2023 16:31 UTC](https://discourse.nodered.org/t/save-email-as-file/77848/5 "2023-06-22T16:31:16Z")

</div>

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