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

**URL:** <https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598>\
**Category:** General\
**Created:** [12 September 2022 09:25 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598 "2022-09-12T09:25:08Z")\
**Posts on this page:** 14\
**Page:** 3

<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:** [27 March 2023 20:50 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/42 "2023-03-27T20:50:16Z")

</div>

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

```auto
$ 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

---

<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:** [27 March 2023 21:10 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/43 "2023-03-27T21:10:45Z")

</div>

If it is relevant, I notice that in node-red-nodes [package.json](https://github.com/node-red/node-red-nodes/blob/master/package.json) it has  
`"nodemailer": "^6.7.2",`

---

<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:** [27 March 2023 22:19 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/44 "2023-03-27T22:19:55Z")

</div>

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

---

<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:** [28 March 2023 07:56 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/45 "2023-03-28T07:56:08Z")

</div>

That seems to have fixed the problem 🙂

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.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [28 March 2023 10:10 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/46 "2023-03-28T10:10:44Z")

</div>

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

---

<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:** [28 March 2023 10:24 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/47 "2023-03-28T10:24:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RandomSporadicProjs](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@RandomSporadicProjs](https://discourse.nodered.org/u/RandomSporadicProjs)\
**Post date:** [30 March 2023 13:50 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/48 "2023-03-30T13:50:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sand\_man](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sand_man/32/68131_2.png) [@sand\_man](https://discourse.nodered.org/u/sand_man)\
**Post date:** [6 April 2023 20:58 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/49 "2023-04-06T20:58:29Z")

</div>

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

---

<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:** [6 April 2023 21:11 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/50 "2023-04-06T21:11:17Z")

</div>

Has upgrading the email node fixed it for you?

---

<div class="post-metadata">

**Author:** ![sand\_man](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sand_man/32/68131_2.png) [@sand\_man](https://discourse.nodered.org/u/sand_man)\
**Post date:** [15 April 2023 09:29 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/51 "2023-04-15T09:29:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sand\_man](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sand_man/32/68131_2.png) [@sand\_man](https://discourse.nodered.org/u/sand_man)\
**Post date:** [15 April 2023 09:44 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/52 "2023-04-15T09:44:27Z")

</div>

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:

```auto
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'.

```

---

<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:** [15 April 2023 10:21 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/53 "2023-04-15T10:21:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sand\_man](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sand_man/32/68131_2.png) [@sand\_man](https://discourse.nodered.org/u/sand_man)\
**Post date:** [15 April 2023 10:39 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/54 "2023-04-15T10:39:20Z")

</div>

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

---

<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:** [29 April 2023 10:40 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/55 "2023-04-29T10:40:14Z")

</div>

Closed on 29 April 2023 10:40 UTC

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

[Previous page](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598.md?page=2)
