# 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:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![julienD](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@julienD](https://discourse.nodered.org/u/julienD)\
**Post date:** [12 September 2022 09:25 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/1 "2022-09-12T09:25:08Z")

</div>

Hello,

I'm sending emails with node-red-node-email. It worked well for some years until some days ;  
I now have to following error "Error: Can not use IPv4 addresses with current network"

Here's the node configuration

```auto
[
    {
        "id": "5a4968db.acd258",
        "type": "e-mail",
        "z": "6ba9417c.86fd5",
        "server": "ssl0.ovh.net",
        "port": "465",
        "secure": true,
        "tls": true,
        "name": "xx@gmail.com",
        "dname": "",
        "x": 890,
        "y": 480,
        "wires": []
    }
]

```

nodered V3.0.1 is installed on an rpi.  
I found nothing about this error crawling the web.

any idea ?

Thanks  
Julien

---

<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:** [12 September 2022 10:50 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/2 "2022-09-12T10:50:26Z")

</div>

What happens if you use the gmail server [smtp.gmail.com](http://smtp.gmail.com)?

---

<div class="post-metadata">

**Author:** ![julienD](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@julienD](https://discourse.nodered.org/u/julienD)\
**Post date:** [12 September 2022 12:58 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/3 "2022-09-12T12:58:16Z")

</div>

Unfortunatey, I was unable to setup gmail as smtp server.  
I have followed various instructions from the web (generated an app pwd...) but it's not successfull.  
I always get ENETUNREACH error.

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [12 September 2022 13:15 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/4 "2022-09-12T13:15:36Z")

</div>

`ENETUNREACH` and the earlier error strongly imply your pi's network is broken.

`ENETUNREACH` means that the remote machine can not be reached, this most likely means that your pi does not have a IPv4 default route

---

<div class="post-metadata">

**Author:** ![julienD](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@julienD](https://discourse.nodered.org/u/julienD)\
**Post date:** [12 September 2022 13:32 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/5 "2022-09-12T13:32:20Z")

</div>

arglll ! tried everything except reboot which did the trick!  
Thanks a lot.

---

<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:** [21 September 2022 13:45 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/6 "2022-09-21T13:45:36Z")

</div>

I am experiencing the same problem. I managed to get a test flow working a few weeks ago. Now, the flow gives the error: "Error: Can not use IPv4 addresses with current network"

Have tried restarting Node-Red; rebooting; upgrading to V3.0.2, completely powering down, removing the network cable to the RPi, etc. None of which appear to work.

Any suggestions much appreciated.

```auto
[
    {
        "id": "1079cc72cc79317d",
        "type": "tab",
        "label": "Outbound email",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "3d7cb306522e7148",
        "type": "e-mail",
        "z": "1079cc72cc79317d",
        "server": "smtp.ionos.co.uk",
        "port": "465",
        "secure": true,
        "tls": true,
        "name": "",
        "dname": "Node-red test email",
        "credentials": {},
        "x": 940,
        "y": 240,
        "wires": []
    },
    {
        "id": "a5f2999e0a316f94",
        "type": "function",
        "z": "1079cc72cc79317d",
        "name": "",
        "func": "\nmsg.payload = \"Test\";\nmsg.topic = \"This is a test email\";\nmsg.to = \"abc@dfe.com\";\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 580,
        "y": 240,
        "wires": [
            [
                "3d7cb306522e7148"
            ]
        ]
    },
    {
        "id": "64b7bf73da0f4b00",
        "type": "inject",
        "z": "1079cc72cc79317d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 260,
        "y": 240,
        "wires": [
            [
                "a5f2999e0a316f94"
            ]
        ]
    },
    {
        "id": "fc361521d5c06297",
        "type": "comment",
        "z": "1079cc72cc79317d",
        "name": "Outbound email test",
        "info": "",
        "x": 250,
        "y": 180,
        "wires": []
    }
]

```

---

<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:** [21 September 2022 14:02 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/7 "2022-09-21T14:02:26Z")

</div>

Can you check a) that you actually have an ipv4 address and b) that you can ping [smtp.ionos.co.uk](http://smtp.ionos.co.uk) and c) that is responds via ipv4.

---

<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:** [21 September 2022 14:09 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/8 "2022-09-21T14:09:01Z")

</div>

Yes it appears to have. Results of ifconfig

eth0: flags=4163\<UP,BROADCAST,RUNNING,MULTICAST\> mtu 1500  
inet 192.168.60.20 netmask 255.255.255.0 broadcast 192.168.60.255  
inet6 fe80::6464:6826:8aca:8eeb prefixlen 64 scopeid 0x20  
ether dc:a6:32:79:53:40 txqueuelen 1000 (Ethernet)  
RX packets 136476 bytes 13123578 (12.5 MiB)  
RX errors 0 dropped 0 overruns 0 frame 0  
TX packets 172858 bytes 40989886 (39.0 MiB)  
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Ping shows about 18ms latency.  
Yes IP V4 addresses are being used.

---

<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:** [21 September 2022 14:20 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/9 "2022-09-21T14:20:49Z")

</div>

Which OS are you using and which version of nodejs ?

(It seems that in Node17 / 18 - they have changed the default reporting order from dns to prioritise ipv6)

---

<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:** [21 September 2022 14:23 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/11 "2022-09-21T14:23:46Z")

</div>

```auto
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

```

---

<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:** [21 September 2022 14:23 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/12 "2022-09-21T14:23:48Z")

</div>

try typing `node -v` at a command prompt.

---

<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:** [21 September 2022 14:24 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/13 "2022-09-21T14:24:25Z")

</div>

node -v

v14.19.3

---

<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:** [21 September 2022 14:24 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/14 "2022-09-21T14:24:51Z")

</div>

hmm - most odd.

---

<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:** [21 September 2022 14:28 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/15 "2022-09-21T14:28:17Z")

</div>

Yes.  
I've been trying all of the 'fat finger' errors I can think off. No luck.  
The network appears to be working.  
The RPi is communicating with other devices.  
The test flow worked previously.

---

<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:** [21 September 2022 14:34 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/16 "2022-09-21T14:34:25Z")

</div>

I guess you could try turning off ipv6 in the Pi network manager. (may need a reboot)

---

<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:** [21 September 2022 14:48 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/17 "2022-09-21T14:48:23Z")

</div>

Removed IPv6. Same error.

`$ ` `sudo` `nano ` `/etc/sysctl` `.conf`

Add this to the end:

`net.ipv6.conf.all.disable_ipv6=1`

`net.ipv6.conf.default.disable_ipv6=1`

`net.ipv6.conf.lo.disable_ipv6=1`

`net.ipv6.conf.eth0.disable_ipv6 = 1`

rebooted

ifconfig now shows:

eth0: flags=4163\<UP,BROADCAST,RUNNING,MULTICAST\> mtu 1500  
inet 192.168.60.20 netmask 255.255.255.0 broadcast 192.168.60.255  
ether dc:a6:32:79:53:40 txqueuelen 1000 (Ethernet)  
RX packets 20418 bytes 2811277 (2.6 MiB)  
RX errors 0 dropped 0 overruns 0 frame 0  
TX packets 25720 bytes 9399504 (8.9 MiB)  
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

---

<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:** [21 September 2022 16:45 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/18 "2022-09-21T16:45:04Z")

</div>

Brute force solution:

Delete email nodes.  
Un install node-red-node-email  
Re install  
Now works.

---

<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:** [27 September 2022 21:08 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/19 "2022-09-27T21:08:08Z")

</div>

Ahhhh ... It's back !

Seems that there is a bug / problem of some sort here.  
Any suggestions for using an alternate emailer?

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [28 September 2022 07:23 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/20 "2022-09-28T07:23:02Z")

</div>

Check you have a functional default route `ip -4 r`

---

<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:** [28 September 2022 20:51 UTC](https://discourse.nodered.org/t/sending-email-error-can-not-use-ipv4-addresses-with-current-network/67598/21 "2022-09-28T20:51:22Z")

</div>

Hello,  
This seems to be OK.

pi@NR1:~/.node-red $ ip -4 r  
default via 192.168.60.1 dev eth0 proto dhcp src 192.168.60.20 metric 202  
192.168.60.0/24 dev eth0 proto dhcp scope link src 192.168.60.20 metric 202

pi@NR1:~/.node-red $ ping 192.168.60.1  
PING 192.168.60.1 (192.168.60.1) 56(84) bytes of data.  
64 bytes from 192.168.60.1: icmp\_seq=1 ttl=255 time=0.250 ms

.

**I have figured out a work around, although not a very elegant one.**

Having installed the Nodejs module nodemailer upon which the Node-red-node-email node is based. The same error is returned.  
However, if nodemailer is configured to connect to the smtp server using an IP address, it works.

.

For other's who may be interested, in outline the steps are:

Install nodemailer:  
1: cd /home/pi/.node-red  
2: npm install nodemailer

[This next step may be optional]  
3: sudo reboot

4: Create a new function within Node-Red  
5: In the Setup tab, add a new Module, with Module name: nodemailer Import as: nodemailer

6: The nodemailer.createTransport call needs to look something like this:

```auto
  // create reusable transporter object using the default SMTP transport
  let transporter = nodemailer.createTransport({

    host: "123.765.23.98", // IP address of the target smtp server
    port: 465, // port at IP address offering smtp service
    secure: true, // true for 465, false for other ports
    tls: {
        // must provide server name, otherwise TLS certificate check will fail
        // Use reverse IP look up to find exact URL on the SSL certificate
        servername: "example.com"
}
    auth: {
      user: "myemail@smtpserver.com", // username
      pass: "my_secret", // password
    },
  });

```

The problem appears to be located somewhere in, or below nodemailer.

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