I am late to the party it seems but I am having issues with sending and receiving emails in Node-Red. I have read many other forum posts discussing the various changes to Gmail and Outlook that have made it difficult to use with Node-Red over the past few months.
I originally used an Outlook email for one of my projects which could send and receive emails correctly. I loaded this project to make some changes and the outgoing email node still works fine. However, I can't get the email in node to work properly. I keep getting the "timed out" or "no response object" error messages. I read something about Outlook now requires a different authentication but no one had a solution for Node-Red.
So I then created a Gmail account and successfully went through the steps to create an app password. However this still doesn't allow either email node to work. I can't send or receive in Node-Red using this account.
I would prefer to use an Outlook account but Gmail would be acceptable also. Is there a way to make these work currently? If not, what other email services work well with Node-Red?
Here is some extra info about the things I've tried and the versions I'm using:
Node-Red v3.0.0
Raspberry Pi 4b running RPI OS (bullseye)
I have verified that for Outlook and Gmail, my IMAP and POP3 access is enabled.
For both Outlook and Gmail (send and receive) I have tried different ports (according to the email clients settings page), checking/unchecking "use secure connections", and TLS options. I will paste a screenshot of the settings I believe to be correct for both incoming and outgoing.
Yes. You have a problem, many other people can send email successfully.
I don't have an Outlook account so I don't know about that, I do use Gmail.
I think the only difference with my email-in node is that I have "Start TLS?" set to Never
I will change my TLS setting to match yours and also trying disabling IPv6 on the Pi.
One other odd thing I noticed is that when I type in the long Google generated app password, if I re-open the email node after deploying, the number of dots representing the characters of the password are much shorter than the actual password should be.
Is the node not taking my new password? Or is this just the default behavior of the node?
I suggest upgrading to the latest node-red version. 3.0.0 was the first of releases of v3 and did have a number of issues. Probably these are not related to your current problem, but worth upgrading anyway. Are you using the latest version of the email node?
It might be worth showing use the output you get when you restart node-red. Run node-red-reload to see it, assuming you used the recommended install script. Attempt to send an email then copy/paste (not screenshot) the whole output here please.
Microsoft have removed legacy login methods for good reason. However, last time I looked you could still create an application password which would probably work. Worth checking anyway.
I'm in the process of updating everything, pi, node-red, specific nodes, etc.
Once everything is updated I'm going to try again and I will also try the Outlook app password. Wasn't aware that existed. It seems strange that the outgoing email node was still working with the Outlook email without any changes.
Here are the things I have tried since my last post.
I updated the Pi through sudo apt update and sudo apt full-upgrade
I updated Node-Red through the recommended script
Node-Red version 3.0.2
Node.js version 16.19.0
Updated Email node - version 1.18.4
Created an Outlook app password
I tried both the incoming and outgoing email nodes with both the Gmail and Outlook email accounts. Both accounts have successful app passwords created.
Gmail - neither incoming or outgoing works
Outlook - only outgoing works
The only thing I haven't tried at this point that has been suggested is disabling IPv6 on the Pi. However I am thinking this might not be the issue since the outgoing for Outlook is working. But I'm not sure.
One person suggested I show the output from the command line when I restart node-red and try to send an email. I have copied the output below after a failed send attempt. I replaced the email address with * but it is the name of the email node. I would also mention that I have tried to send to three different email addresses that are different domains with the same result.
Does anyone have any other suggestions?
Starting as a systemd service.
11 Jan 13:54:10 - [info]
Welcome to Node-RED
===================
11 Jan 13:54:10 - [info] Node-RED version: v3.0.2
11 Jan 13:54:10 - [info] Node.js version: v16.19.0
11 Jan 13:54:10 - [info] Linux 5.15.84-v7l+ arm LE
11 Jan 13:54:11 - [info] Loading palette nodes
11 Jan 13:54:13 - [info] Dashboard version 3.2.0 started at /ui
11 Jan 13:54:14 - [info] Settings file : /home/mtg/.node-red/settings.js
11 Jan 13:54:14 - [info] Context store : 'default' [module=memory]
11 Jan 13:54:14 - [info] User directory : /home/mtg/.node-red
11 Jan 13:54:14 - [info] Projects directory: /home/mtg/.node-red/projects
11 Jan 13:54:14 - [info] Server now running at http://127.0.0.1:1880/
11 Jan 13:54:14 - [info] Active project : Auto_Test_Panel
11 Jan 13:54:14 - [info] Flows file : /home/mtg/.node-red/projects/Auto_Test_Panel/flow.json
11 Jan 13:54:14 - [warn] Using unencrypted credentials
11 Jan 13:54:14 - [info] Starting flows
11 Jan 13:54:14 - [info] Started flows
11 Jan 13:56:24 - [error] [e-mail:*******@*****.com] Error: Connection timeout
I'm not opposed to trying it. I just don't know enough about IPv6 to understand the effect disabling it might have on other projects down the road. But it will be worth it if it fixes the issue. I will follow the link you posted and share the results.
I followed the steps in the article you linked for Method #2. I did this because the article and the comment at the bottom seems to indicate the Method #1 doesn't always work.
I verified using ifconfig that I don't have inet6 which I believe means IPv6 is disabled. At least that's what the article seems to indicate.
Here is the output again, appears to be the same.
Starting as a systemd service.
11 Jan 14:44:46 - [info]
Welcome to Node-RED
===================
11 Jan 14:44:46 - [info] Node-RED version: v3.0.2
11 Jan 14:44:46 - [info] Node.js version: v16.19.0
11 Jan 14:44:46 - [info] Linux 5.15.84-v7l+ arm LE
11 Jan 14:44:48 - [info] Loading palette nodes
11 Jan 14:44:52 - [info] Dashboard version 3.2.0 started at /ui
11 Jan 14:44:53 - [info] Settings file : /home/mtg/.node-red/settings.js
11 Jan 14:44:53 - [info] Context store : 'default' [module=memory]
11 Jan 14:44:53 - [info] User directory : /home/mtg/.node-red
11 Jan 14:44:53 - [info] Projects directory: /home/mtg/.node-red/projects
11 Jan 14:44:53 - [info] Server now running at http://127.0.0.1:1880/
11 Jan 14:44:53 - [info] Active project : Auto_Test_Panel
11 Jan 14:44:53 - [info] Flows file : /home/mtg/.node-red/projects/Auto_Test_Panel/flow.json
11 Jan 14:44:53 - [warn] Using unencrypted credentials
11 Jan 14:44:53 - [info] Starting flows
11 Jan 14:44:53 - [info] Started flows
11 Jan 14:51:05 - [error] [e-mail:******@*****.com] Error: Connection timeout
I had a brand new RPI Zero W that I hadn't opened yet. So I set it up, updated, installed Node-Red, and installed the email node.
I was having the same issue, but then I thought maybe it has something to do with my company wi-fi (Lately it seems like that is the hurdle 90% of the time). Sure enough, I connected the Pi to my phone's hotspot and it sent and received emails with my Gmail account. I didn't try Outlook but I assume it will work as well.
I went back to my company wi-fi and there was the timeout issue again. I do have a slightly different error this time though.
The first mention of the email node shows the successful attempt to send. The following has the new error, albeit still a timeout error.
11 Jan 15:39:20 - [warn] Encrypted credentials not found
11 Jan 15:39:21 - [info] Server now running at http://127.0.0.1:1880/
11 Jan 15:39:21 - [info] Starting flows
11 Jan 15:39:21 - [info] Started flows
11 Jan 15:40:29 - [info] Setting active project : Email_Example
11 Jan 15:40:29 - [info] Flows file : /home/piman/.node-red/projects/Email_Example/flow.json
11 Jan 15:40:29 - [info] Stopping flows
11 Jan 15:40:29 - [info] Stopped flows
11 Jan 15:40:29 - [warn] Using unencrypted credentials
11 Jan 15:40:29 - [info] Starting flows
11 Jan 15:40:29 - [info] Started flows
11 Jan 15:40:45 - [info] Installing module: node-red-node-email, version: 1.18.4
11 Jan 15:41:21 - [info] Installed module: node-red-node-email
11 Jan 15:41:25 - [info] Added node types:
11 Jan 15:41:25 - [info] - node-red-node-email:e-mail
11 Jan 15:41:25 - [info] - node-red-node-email:e-mail in
11 Jan 15:41:25 - [info] - node-red-node-email:e-mail mta
11 Jan 15:42:24 - [info] Stopping flows
11 Jan 15:42:24 - [info] Stopped flows
11 Jan 15:42:24 - [info] Updated flows
11 Jan 15:42:24 - [info] Starting flows
11 Jan 15:42:24 - [info] Started flows
11 Jan 15:42:31 - [info] [e-mail:********@*****.edu] Message sent: 250 2.0.0 OK 1673473351 v7-20020a05620a440700b006fb112f512csm9755942qkp.74 - gsmtp
11 Jan 15:43:37 - [info] Stopping flows
11 Jan 15:43:37 - [info] Stopped flows
11 Jan 15:43:37 - [info] Updated flows
11 Jan 15:43:37 - [info] Starting flows
11 Jan 15:43:37 - [info] Started flows
11 Jan 15:52:40 - [error] [e-mail:********@*****.edu] Error: Connection timeout
11 Jan 15:55:58 - [error] [e-mail in:0425f53e77899590] connect ETIMEDOUT 142.250.31.109:993
The thing I can't quite wrap my head around, is that if my company wi-fi is blocking or interfering with this, why will the outgoing Outlook node work? And why does it work without an app password as well? My ultimate question is still how to make this work. I'll go ahead and mention that I have little control over the network, but I would still like to hear suggestions as I may be able to make some changes.
Most likely because they are blocking inbound port 993 but not blocking the outbound possibly because it is using TLS auth before send and maybe going out on port 443. Or something like that anyway, you'd have to check the actual network traffic.
I see what you are saying but then why won't the Gmail outgoing send?
Also just for added information, about a year ago or so, I was able to use both the incoming and outgoing email nodes with Outlook account on my company wi-fi.
What companies allow on their networks changes over time as threats evolve and defensive measures have to be put in place. So no doubt some policy has changed.
In a situation like this you need to try the command line tools on your pi.
See whether netcat (nc smtp.gmail.com 465) connects, type some characters and see whether it then disconnects. You can also use the openssl command line, look up how to verify the TLS cert of a server using the openssl cli tool. This way you can figure out what the network lets through and what not. Then you can move to configuring Node-RED...