I can't get smtps
to work at all, no matter what machine or version of Node I try (four different machines). Nodemailer 2.3.0, Node 0.12.1, 4.2.1, 4.2.3, and 4.4.2, on Windows 10 and OS X 10.10.5 and others.
$ node -e "require('nodemailer').createTransport('smtps://smtp.gmail.com:587').sendMail({}, function(e) {console.log(e);})"
[Error: 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:]
I get the same result for smtps://smtp.postmarkapp.com:587
. CheckTLS and a raw openssl
command both connect fine, so I'm pretty sure the problem is not with the SMTP servers. openssl
indicates that all protocols from SSLv3 up to TLS1.2 are supported so it shouldn't be a secureProtocol
issue as hinted at in #358.
The error points to this line in openssl
, which AFAICT means that the ServerHello
packet just can't be parsed at all.
Any idea what I'm doing wrong? Or is smtps
just broken in Nodemailer 2.3.0? Thanks.
I also tried nodemailer@beta
with the same result.
Port 587 is not smtps but smtp. The connection starts out as plaintext and is later upgraded to TLS automatically (if supported by the server) by STARTTLS call. Use smtp://smtp.gmail.com:587
or smtps://smtp.gmail.com:465
.
Ah, so smtps
is equivalent to options.secure
rather than options.requireTLS
, is that it? OK.
Yes, the "s" in the end of any protocol name usually means that the connection should be initialized using TLS. This should work: smtp://smtp.gmail.com:587/?requireTLS=true
Oh awesome, I was just looking for that! Thanks! :sparkling_heart:
Most helpful comment
Yes, the "s" in the end of any protocol name usually means that the connection should be initialized using TLS. This should work:
smtp://smtp.gmail.com:587/?requireTLS=true