Email Node with Attachements does not work

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.

This is how I prepare my email.

And this is how my flow works: image It worked already, but suddenly stopped.

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?

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.

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)

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.

Ok, so what is in the debug message?

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

image

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

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

image

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

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?

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.

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.

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

1 Like

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"

oops - refixed in 1.11.0

Fixed, Is OK with 1.11.0

2 Likes

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

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