I am trying to send an email with nodemailer. I already managed to send it from another host but now I want to send emails from another address. These are the versions of nodemailer I am using (from my package.json
):
"nodemailer": "1.3.4",
"nodemailer-smtp-transport": "1.0.2",
This is the information I have about my webmail:
I set up nodemailer like this:
var transport = nodemailer.createTransport(smtpTransport({
host: 'securemail.linevast.de',
port: 465,
secure: true,
auth: {
user: '[email protected]', // this is my login name
pass: 'mypassword'
},
maxConnections: 5,
maxMessages: 10
}));
And when I try to send an email I get the following error message.
[Error: certificate not trusted] code: 'CERT_UNTRUSTED'
The website is verified by GeoTrust Inc so I believe it is quite trustworthy. Is there a way to make nodemailer trust the certificate or force it to send the email even though it does not trust it?
Thank you for your help!
Debugging options in Nodemailer It is simple with Nodemailer: set both debug and logger to true and you will be able to see all the data which is passed to the server as an output in the console. This way, you will be able to analyze the email sending process and quickly fix errors, if there are any.
tls – defines additional node. js TLSSocket options to be passed to the socket constructor, eg. {rejectUnauthorized: true}. tls.servername - is optional hostname for TLS validation if host was set to an IP address.
Nodemailer - Works locally but not on production.
Yes, you can tell nodemailer to not check the certificate trust.
This is the option:
tls: {rejectUnauthorized: false}
use it on the initial transport object:
var transporter = nodemailer.createTransport(smtpTransport('SMTP',{
host: 'mail.mailserver.com',
port: 587,
auth: {
user: '[email protected]',
pass: 'passwd'
},
authMethod:'NTLM',
secure:false,
// here it goes
tls: {rejectUnauthorized: false},
debug:true
})
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With