# Email Node with Attachements does not work

**URL:** <https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402>\
**Category:** General\
**Created:** [30 March 2021 12:32 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402 "2021-03-30T12:32:21Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![khelper](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@khelper](https://discourse.nodered.org/u/khelper)\
**Post date:** [30 March 2021 12:32 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/1 "2021-03-30T12:32:21Z")

</div>

Hi all,

I want to send an email with attachment.

Up until last week my flow worked, but it suddenly stopped and I just cannot find out why.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/e/3e04c27279669ffbebf598fee8f4b36c1698191d.png) This is how I prepare my email.

And this is how my flow works: ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/8/6872121f901ed604310ec0c4584116301e599080.png) It worked already, but suddenly stopped.

---

<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:** [30 March 2021 13:01 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/2 "2021-03-30T13:01:58Z")

</div>

Welcome to the forum!

Sooo, what changed since last week? Did you do any updates to any nodes or your OS or did your isp make any changes?

---

<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:** [30 March 2021 13:45 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/3 "2021-03-30T13:45:15Z")

</div>

> [@khelper](#):
>
> it suddenly stopped

Can you clarify the exact problem? What is "it"

Your flow stopped?

Or Emails stopped sending - if so, how do you know - are you getting an error in node-red?

Or do you mean it still sends and you get the email - but attachment is missing?

Or do you mean you simply stopped receiving any emails at all from this node-red?

Or something else?

Please clarify.

> [@khelper](#):
>
> I just cannot find out why

Have you tried sending to a different email address?

Have you tried sending without the attachment to see if mails send without attachments?

Have you tried an alternative email provider (alternative SMTP)?

Can the node-red server (PI?) access the SMTP server? (try adding a ping node and ping the SMPT provider)

---

<div class="post-metadata">

**Author:** ![khelper](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@khelper](https://discourse.nodered.org/u/khelper)\
**Post date:** [30 March 2021 14:18 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/4 "2021-03-30T14:18:46Z")

</div>

HI Steve,

sorry this was poorly written.

Emails are still sending, but without attachments. I get the email, but without the desired attachment.  
I tried different emails.  
The email node works fine for other flows. I am using it on multiple occasions.

---

<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:** [30 March 2021 14:22 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/5 "2021-03-30T14:22:28Z")

</div>

Ok, so what is in the debug message?

Show me what is in `msg.attachments` (expand that debug msg)

---

<div class="post-metadata">

**Author:** ![khelper](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@khelper](https://discourse.nodered.org/u/khelper)\
**Post date:** [30 March 2021 14:58 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/6 "2021-03-30T14:58:57Z")

</div>

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

It is a buffer object from the 'file in' node.

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [30 March 2021 15:34 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/7 "2021-03-30T15:34:55Z")

</div>

The mail node's help mentions that the attachments need to be an array :

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

You have it as an object .. try to wrap it around square brackets and see if it helps  
msg.attachments = [...]

ps. you still havent posted the error msg that you are actually seeing

---

<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:** [30 March 2021 16:09 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/8 "2021-03-30T16:09:01Z")

</div>

So have you compared the msg being sent to the `email` nodes that work to the one that doesn't work?

Any you never answered my first question: What changed?

---

<div class="post-metadata">

**Author:** ![khelper](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@khelper](https://discourse.nodered.org/u/khelper)\
**Post date:** [31 March 2021 06:28 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/9 "2021-03-31T06:28:36Z")

</div>

There where no changes, as far as I know.  
The email nodes are copy pasted and I actually get the email just without the attachment.

---

<div class="post-metadata">

**Author:** ![khelper](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@khelper](https://discourse.nodered.org/u/khelper)\
**Post date:** [31 March 2021 06:29 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/10 "2021-03-31T06:29:38Z")

</div>

Hi UnborN,

I will try that.

I did not post the error msg because there is no error. I receive the emails but the attachment is missing.

---

<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:** [31 March 2021 09:00 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/11 "2021-03-31T09:00:33Z")

</div>

Hi - I have pushed a small fix to the node so it should now at least alert you if the attachment is invalid.

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [1 April 2021 07:27 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/12 "2021-04-01T07:27:36Z")

</div>

`Node-Red 1.2.9, NodeJS 14.16.0, Ubuntu`

Same email with 2 attachments (image buffer).  
Whit node-red-node-email version \<= `1.10.1` all is OK.  
Whit version `1.10.2` email node throw error : `"TypeError: Cannot read property 'length' of undefined"`

---

<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:** [1 April 2021 08:37 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/13 "2021-04-01T08:37:56Z")

</div>

oops - refixed in 1.11.0

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [1 April 2021 08:57 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/14 "2021-04-01T08:57:11Z")

</div>

**Fixed** , Is OK with `1.11.0`

---

<div class="post-metadata">

**Author:** ![chrisn-au](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chrisn-au/32/25504_2.png) [@chrisn-au](https://discourse.nodered.org/u/chrisn-au)\
**Post date:** [5 April 2021 22:20 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/15 "2021-04-05T22:20:26Z")

</div>

Had exactly the same problem but frustratingly it occurred at the same time I was migrating node-red instances (hence the newer email version). Thanks @dceejay all appears to be working now.

Has motivated me to add a catch node to all my flows to send errors to slack

---

<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 June 2021 22:20 UTC](https://discourse.nodered.org/t/email-node-with-attachements-does-not-work/43402/16 "2021-06-04T22:20:44Z")

</div>

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