# Error: connect ENETUNREACH on node-red-node-email

**URL:** <https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971>\
**Category:** General\
**Created:** [13 October 2022 09:34 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971 "2022-10-13T09:34:39Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [14 October 2022 07:27 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/21 "2022-10-14T07:27:24Z")

</div>

Could it be related to this ?

> <https://github.com/nodemailer/nodemailer/issues/1437#issuecomment-1176148148>
>
> BACKGROUND:
> 
> \- sometimes, virtualized servers or environments, make use of com…mon network interfaces (i.e. FreeBSD jails), provided by the hosting system.
> \- it is common, to use a cloned loopback interface of the parent system for relaying traffic in and out to the child systems
> \- In those cases the child has an interface, that, if you are running node.js on that child and use \`os.networkInterfaces()\`, is is marked as "internal" (which is correct, but for the child its the only interface to the external world and as such is "external")
> \- We need to have an option to tell nodemailer, that it can also make use of internal interfaces.
> 
> IS
> \- using nodemailer in the described setup, the following error is thrown: 
> \`\`\`
> Can not use IPv(4|6) addresses with current network
> =\> lib/shared/index.js, 210
> \`\`\` 
> 
> SHOULD
> \- a configuration should allow to avoid testing, if os network interfaces are internal
> \`\`\`javascript
> const mailConfig = {
> pool: true,
> host: 'my.funyy.mailhost.com',
> secure: true,
> allowInternalNetworkInterfaces: true,
> auth: {
> user: process.env\['SMTP\_USER'\],
> pass: process.env\['SMTP\_PWD'\]
> },
> }
> \`\`\`
> 
> \- This option should then be considered in function \`isFamilySupported(family)\` in \`lib/shared/index.js\`
> \`\`\`javascript
> const isFamilySupported = family =\> {
> const familySupported =
> // crux that replaces Object.values(networkInterfaces) as Object.values is not supported in nodejs v6
> Object.keys(networkInterfaces)
> .map(key =\> networkInterfaces\[key\])
> // crux that replaces .flat() as it is not supported in older Node versions (v10 and older)
> .reduce((acc, val) =\> acc.concat(val), \[\])
> .filter(i =\> !i.internal) // this should optionally be not filtered
> .filter(i =\> i.family === 'IPv' + family || i.family === family).length \> 0;
>   
> return familySupported;
> };

---

<div class="post-metadata">

**Author:** ![Switchblade2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/switchblade2/32/60655_2.png) [@Switchblade2](https://discourse.nodered.org/u/Switchblade2)\
**Post date:** [14 October 2022 11:49 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/22 "2022-10-14T11:49:52Z")

</div>

It worked fine for 12 hours and then stop after an reboot (updated mosquito service)  
I know have the (related?) "Error: Can not use IPv4 addresses with current network".

Update with Full error message:  
Error: Can not use IPv4 addresses with current network at GetAddrInfoReqWrap.callback (/home/pi/.node-red/node\_modules/node-red-node-email/node\_modules/nodemailer/lib/shared/index.js:203:35) at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:132:8)

---

<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:** [14 October 2022 11:54 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/23 "2022-10-14T11:54:01Z")

</div>

I think it's the same problem.  
What does **node -v** show?

---

<div class="post-metadata">

**Author:** ![Switchblade2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/switchblade2/32/60655_2.png) [@Switchblade2](https://discourse.nodered.org/u/Switchblade2)\
**Post date:** [14 October 2022 12:02 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/24 "2022-10-14T12:02:13Z")

</div>

I'm on v16.18.0

---

<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:** [14 October 2022 12:41 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/25 "2022-10-14T12:41:17Z")

</div>

I notice there are some "fixes" to the nodemailer lib package mentioning DNS... I have updated the email node to 1.18.0 to pull in the latest... Can someone see if that helps ?

---

<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:** [14 October 2022 15:24 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/26 "2022-10-14T15:24:19Z")

</div>

An update:

I found out how to roll back to nodejs 16.7.0

```auto
wget https://deb.nodesource.com/node_16.x/pool/main/n/nodejs/nodejs_16.17.0-deb-1nodesource1_arm64.deb
sudo apt install -f ./nodejs_16.17.0-deb-1nodesource1_arm64.deb

```

nodejs changed from 16.17.1 to 16.17.0 and the gmail problem disappeared.  
However, today, reverting to 16.17.1 using either apt upgrade or the Node-red install script, the problem doesn't come back.  
This is different to yesterday when I rolled back to nodejs14.  
And I have repeated yesterday's test several times. The problem does not want to come back.

node-red-node-email is still 1.17.0

---

<div class="post-metadata">

**Author:** ![Switchblade2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/switchblade2/32/60655_2.png) [@Switchblade2](https://discourse.nodered.org/u/Switchblade2)\
**Post date:** [15 October 2022 06:08 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/27 "2022-10-15T06:08:06Z")

</div>

I managed to get it working by shifting from wifi to ethernet cable, and then back to wifi only as well as deactivating IPv6 from the GUI wifi icon. So far stable.

node-red-node-email is stilll on 1.17.0

---

<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 October 2022 06:21 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/28 "2022-10-15T06:21:16Z")

</div>

It would be helpful if you could make it fail again and then upgrade the email node to see if that finally fixes it

---

<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:** [15 October 2022 07:34 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/29 "2022-10-15T07:34:12Z")

</div>

If only it was that simple!

---

<div class="post-metadata">

**Author:** ![mike7](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@mike7](https://discourse.nodered.org/u/mike7)\
**Post date:** [21 October 2022 19:31 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/30 "2022-10-21T19:31:36Z")

</div>

Hi, I'm totally new to this forum.  
I've got the same problem as described and have updated the node. The problem still persists. I'm running v16.17.0

---

<div class="post-metadata">

**Author:** ![Switchblade2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/switchblade2/32/60655_2.png) [@Switchblade2](https://discourse.nodered.org/u/Switchblade2)\
**Post date:** [25 October 2022 07:18 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/31 "2022-10-25T07:18:40Z")

</div>

I was offline due to a cut fibre cable for 2 weeks (definitely blocks all emails).  
When the internet connection was working again the mail node work for approx 1h sending several mails but then stopped with the "Error: Can not use IPv4 addresses with current network".

Upgrading node-red-node-email to 1.18.1 did not fix it.

I got it working again connecting via both wifi & ethernet cable, with IPv6 deactivated.  
I'll try to run on only ethernet cable and see how that works ...

---

<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:** [16 December 2022 16:05 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/32 "2022-12-16T16:05:22Z")

</div>

I get this quite regularly recently. It seems to be triggered by switching between wifi and wired ethernet, though I am not sure exactly what to do to make it happen. As far as I can see everything other than the email node continues as normal.  
A node red restart fixes it. If anyone can suggest anything to look at to help diagnose exactly what is going on then I can try it next time it happens.

Standard install running on Ubuntu  
Node red 3.0.2  
nodejs 16.18.1  
node-red-node-email 1.18.2

---

<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:** [14 February 2023 16:05 UTC](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971/33 "2023-02-14T16:05:57Z")

</div>

Closed on 14 February 2023 16:05 UTC

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

[Previous page](https://discourse.nodered.org/t/error-connect-enetunreach-on-node-red-node-email/68971.md?page=1)
