If that is the case, I believe SMTP service is unable to make connection to connection on port 25.
Running server will look like:
$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 xxxx.de ESMTP Postfix
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
If there is no server listening on this port, it will like this:
$ telnet localhost 25
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
This means your services might not be running or enabled. You need to first enable/run this service on port 25.
Also, according to the nodemail documentation you can use the sendmail binary as well:
'sendmail' alternative
Alternatively if you don't want to use SMTP but the sendmail
command then set property sendmail to true (or as the path to sendmail if the command is not in default path).
nodemailer.sendmail = true;
or
nodemailer.sendmail = '/path/to/sendmail';
If sendmail is set, then SMTP options are discarded.
for reference, https://nodemailer.com/transports/sendmail/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…