Sending email : "Error can not use ipv4 addresses with current network"

I removed node-red-node-email and then installed it again via command line, without errors. However, if I then do npm list nodemailer I see

$ npm list nodemailer
npm ERR! code ELSPROBLEMS
npm ERR! invalid: nodemailer@6.8.0 /home/colinl/.node-red/node_modules/node-red-node-email/node_modules/nodemailer
tigger@1.0.0 /home/colinl/.node-red
└─┬ node-red-node-email@1.19.0
  ├─┬ mailparser@3.5.0
  │ └── nodemailer@6.7.3
  ├── nodemailer@6.8.0 invalid: "^6.9.1" from node_modules/node-red-node-email
  └─┬ smtp-server@3.11.0
    └── nodemailer@6.7.3


npm ERR! A complete log of this run can be found in:
npm ERR!     /home/colinl/.npm/_logs/2023-03-27T20_36_41_646Z-debug-0.log

And when I start node-red it says the email node is not installed.
I can't make sense of the error, as if I install nodemailer I do get 6.9.1

If it is relevant, I notice that in node-red-nodes package.json it has
"nodemailer": "^6.7.2",

bumped to 1.19.1 to update mail parser as well to be in line...

That seems to have fixed the problem :slight_smile:

I will do a bit more testing and confirm.
Anyone else who has seen the problem please update node-red-node-email and see it if fixes it for you.

I found that updating via Palette Manager tries to install 1.19.0 and gives an error.
npm install node-red-node-email did install 1.19.1

I think that you were maybe just a bit quick off the mark. Manage palette is now offering 1.19.1

Updated both machines via Palette Manager and all seems well - thanks

Sorry for the delayed reply. I am using wired Ethernet (not WiFi).

Has upgrading the email node fixed it for you?

I have just upgraded to node-email v 1.9.1

I am now able to use the URL of my SMTP service rather than the IP address.

The 'send email' node now appears to work correctly.

So yes. It appears to be working.

Thank you everyone.

On a slightly different, but related topic.
I discovered an issue in the workaround function that I had written which uses nodemailer.createTransport to send emails. The issue caused Node-Red to crash (exit-code) and restart. (In my case during stormy weather, leading me to investigate intermittent hardware connections.)

The issue occurs if the function is called with a null msg.payload

The log below might help someone else searching for a solution to a similar problem in future.

syslog contained the following:

Apr 12 09:17:17 NR1 Node-RED[]: 12 Apr 09:17:17 - [error] [function:Send email using nodemailer] Error: No recipients defined
Apr 12 09:17:17 NR1 Node-RED[]: 12 Apr 09:17:17 - [red] Uncaught Exception:
Apr 12 09:17:17 NR1 Node-RED[]: 12 Apr 09:17:17 - [error] TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object
Apr 12 09:17:17 NR1 Node-RED[]:     at new NodeError (internal/errors.js:322:7)
Apr 12 09:17:17 NR1 Node-RED[]:     at PassThrough.Writable.write (internal/streams/writable.js:285:13)
Apr 12 09:17:17 NR1 Node-RED[]:     at PassThrough.Writable.end (internal/streams/writable.js:567:10)
Apr 12 09:17:17 NR1 Node-RED[]:     at Immediate._onImmediate (/home/pi/.node-red/node_modules/nodemailer/lib/mime-node/index.js:977:46)
Apr 12 09:17:17 NR1 Node-RED[]:     at processImmediate (internal/timers.js:464:21)
Apr 12 09:17:17 NR1 systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
Apr 12 09:17:17 NR1 systemd[1]: nodered.service: Failed with result 'exit-code'.

You need to catch the error in your function to stop it crashing node red. Or just use the updated email node of course.

Hi, yes indeed. Erroneously the function I'd written sent a null msg.payload during stormy weather.

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