# Emailing a downloadable file with node red

**URL:** <https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592>\
**Category:** General\
**Created:** [1 September 2024 04:38 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592 "2024-09-01T04:38:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dnice](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Dnice](https://discourse.nodered.org/u/Dnice)\
**Post date:** [1 September 2024 04:38 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/1 "2024-09-01T04:38:16Z")

</div>

Looking to send email with a file.  
Not in the body of the email but as a downloadable attachment

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [1 September 2024 05:28 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/2 "2024-09-01T05:28:22Z")

</div>

Welcome

How to do that is explained in the help section for the stock node-red-node-email node. You assign msg.attachments to an array of your file names.

Create something like this before the email node (in a function node for example):

```auto
msg.attachments = [{   
    filename: 'your-filename', // file on disk as an attachment
    path: '/path/to/your-filename' // stream this file
}]

```

---

<div class="post-metadata">

**Author:** ![Dnice](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Dnice](https://discourse.nodered.org/u/Dnice)\
**Post date:** [1 September 2024 15:42 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/3 "2024-09-01T15:42:29Z")

</div>

Thanks no I  
Still posts to file data to body of email  
Maybe I got my flow wrong?  
Should I be using read file ?

---

<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:** [1 September 2024 18:30 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/4 "2024-09-01T18:30:06Z")

</div>

Export your flow and paste it to a reply so people can look at what you are doing.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![Dnice](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Dnice](https://discourse.nodered.org/u/Dnice)\
**Post date:** [4 September 2024 16:24 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/5 "2024-09-04T16:24:00Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/0/b098debf1e95bb2534a898078445d0a90ef66dc6.png)

---

<div class="post-metadata">

**Author:** ![Dnice](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Dnice](https://discourse.nodered.org/u/Dnice)\
**Post date:** [4 September 2024 16:38 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/6 "2024-09-04T16:38:01Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/d/3dd2d7aa43bd6ba4b525b42039efda48d1274340.png)

---

<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:** [4 September 2024 23:44 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/7 "2024-09-04T23:44:58Z")

</div>

Nice picture but that is not an export of your flow.

---

<div class="post-metadata">

**Author:** ![Dnice](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@Dnice](https://discourse.nodered.org/u/Dnice)\
**Post date:** [5 September 2024 00:12 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/8 "2024-09-05T00:12:08Z")

</div>

lol sorry  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b8eebcfbbb905b8bdb950525d4078b2da7520243.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 September 2024 08:39 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/9 "2024-09-05T08:39:41Z")

</div>

Still not an export of your flow unfortunately.

Select the nodes that are relevant to the problem and then select Export in the dropdown menu (or CTRL+E). Then select Copy to Clipboard and paste it in a reply here. When pasting use the `</>` button at the top of the forum entry window so it is formatted correctly for the forum.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````), which is what the `</>` button does.

````auto
``` 
   code goes here 
```

````

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<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:** [5 September 2024 11:07 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/10 "2024-09-05T11:07:39Z")

</div>

Looking at your debug - you seem to have crossed the wires... You probably want `msg.attachments[0].filename` to be "salem\_2024090419.csv" and `msg.attachments[0].content` to be msg.payload (ie the buffer)

---

<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:** [4 December 2024 11:08 UTC](https://discourse.nodered.org/t/emailing-a-downloadable-file-with-node-red/90592/11 "2024-12-04T11:08:33Z")

</div>

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