I have recently migrated the mail sending process from php (using PHPMailer) to a newer and optimized Nodejs backend (using Nodemailer).
And this was a semi-successful miragration, as for the most part Nodemailer is able to successfully send the emails throughgmail.com and some other specific proprietary domains.
However, I have tested some client configurations that just won't work, some also from specific proprietary domains and one fromoffice365.com.
As the title mentions, the error I come across isssl3_get_record:wrong version number
.
I have read multiple posts regarding this issue and tried various suggested configurations, all to no effect.
My connection request, with all the basic host, port, auth username and password settings, additionally include the following:
request = { .. requireTLS: true, ignoreTLS: false, tls: { ciphers: 'TLS_AES_128_GCM_SHA256', minVersion: 'TLSv1.2', // advisable TLS 1.2 or higher rejectUnauthorized: false, },}
Additionally I tried the followingtls
settings, although not advised for a prodution environment, but I figured it was worth the try just to see if it would work:
tls: { ciphers: 'ALL', minDHSize: 512, minVersion: 'TLSv1', maxVersion: 'TLSv1.3', }
Every try and configuration combination I have tried, all resulted in thessl3_get_record:wrong version number
error.
The thing is that PHPMailer was able to work with these accounts..
..all except for theoffice356.com one, if I recall correctly.
Could it be that PHPMailer is less secure and somehow bypasses this issue by sending in the information in a generalized manner that servers would just gobble up, no questions asked?
Honestly I am running out of ideas.
I find it hard to believe a more recent package like Nodemailer gets stuck in something like this, while PHPMailer is apparently able to work around it - somehow.
Any help will be greatly appreciated.
Thanks in advance.
- Please provide the exact code you use, not just the fragments you consider relevant. Relevant details are for example the exact host (there is no host office365.com, maybe smtp.office365.com?) and port (25, 465, 587), ...Steffen Ullrich– Steffen Ullrich2025-09-23 16:39:47 +00:00CommentedSep 23 at 16:39
- Hello @SteffenUllrich, You are right, I should have been more specific. I know
office365.com
is not the host, I was just refering to the domain. The host in the configuration is indeedsmtp.office365.com
, with port 587 andsecure: false
setting. I have come to understand that port 587 and 25 inherently use STARTTLS, which requires thesecure: false
setting in Nodemailer's createTransport(..) method. Regarding port 465, it uses Implicit TLS, which requires thesecure: true
setting in Nodemailer's createTransport(..) method.mformigo– mformigo2025-09-24 15:53:54 +00:00CommentedSep 24 at 15:53 - So, using a port with the wrong
secure
value setting would always result in thessl3_get_record:wrong version number
- error that in itself is a bit misleading as to the cause. As of now I have seem to been able to work around as I am no longer getting that error, but stumbled into another smtp snap, which I am currently trying to understand and resolve - this one all indicates is specific to 'office365.com' - before I enventually publish a response here to answer the question and clarify future similar issues.mformigo– mformigo2025-09-24 16:00:41 +00:00CommentedSep 24 at 16:00