node-red / node-red-nodes

Extra nodes for Node-RED
Other
964 stars 592 forks source link

Can't send emails using fresh install + `node-red-node-email` on Raspberry Pi/Debian #1044

Closed 01tot10 closed 5 months ago

01tot10 commented 5 months ago

Which node are you reporting an issue on?

node-red-node-email

What are the steps to reproduce?

What happens?

The email node hangs with the text sending email for a long while, after which it fails displaying:

Error: queryA ETIMEOUT smtp.gmail.com

I tried the exact same flow with my older node-RED instance, and the email goes through. Thus, I feel like the error shouldn't be about internet/router problems. Also, my current node-RED instance can access the internet normally.

I'm using gmail to send the email, and I know how to set an application password. Also, I can read emails from my inbox using my new instance, so the application password seems to work.

What do you expect to happen?

The email to be sent

Please tell us about your environment:

hardillb commented 5 months ago

The error message implies a DNS problem on that pi.

What happens if you run nsloopkup smtp.gmail.com or ping smtp.gmail.com from a shell in that pi?

01tot10 commented 5 months ago

Hey @hardillb!

Thanks for the quick reply. You're right ping smtp.gmail.com doesn't result in anything using the new instance, while the old one pings nicely. I'll investigate the cause and report back.

01tot10 commented 5 months ago

Wait, no, that was incorrect! The new instance also pings, but it just takes a while to get started. Don't know if that is a symptom of something? Here are the ping results:

PING smtp.gmail.com(lq-in-x6c.1e100.net (2a00:1450:4010:c0d::6c)) 56 data bytes
64 bytes from lq-in-f108.1e100.net (2a00:1450:4010:c0d::6c): icmp_seq=1 ttl=57 time=14.6 ms
64 bytes from lq-in-f108.1e100.net (2a00:1450:4010:c0d::6c): icmp_seq=2 ttl=57 time=13.4 ms
...
01tot10 commented 5 months ago

Managed to fix it! Thanks @hardillb for pointing me to the right direction with the DNS problem.

This was basically an error on my side, related to the confusion brought up by Raspberry Pi OS Bookworm changing the way how network connections are managed (see, ex. here).

In my case, I had multiple DNS entries in my /etc/resolv.conf, out of which the first one was unresponsive. The unresponsive DNS entry was revealed by running nslookup www.google.com, as helpfully suggested earlier. Apparently, the unresponsive DNS entry was used by node-RED, and it never made it to the second one?

I fixed the problem by fiddling with my router settings, since the unresponsive DNS entry was originating from there.