I'm trying to send emails from my application using nodemailer.
My setup look like this:
var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');
var transporter = nodemailer.createTransport(smtpTransport ({
host: 'smtp.companyname.dk',
secureConnection: true,
port: 587,
auth: {
user: 'support@companyname.dk',
pass: '****'
}
}));
var mailOptions = {
from: 'Olaf <ob@companyname.dk>',
to: 'john@test.dk',
subject: 'This is a test ',
text: 'Hello world ',
html: '<b>Hello world </b>'
};
transporter.sendMail(mailOptions, function(error, info){
if(error){
console.log(error);
}else{
console.log('Message sent: ' + info.response);
}
});
After running this, it gives me the following error:
{ [Error: Hostname/IP doesn't match certificate's altnames: "Host: smtp.companyname.dk. is not in the cert's altnames: DNS:*.mailcloud.dk, DNS:mailcloud.dk"]
reason: 'Host: smtp.companyname.dk. is not in the cert\'s altnames: DNS:*.mailcloud.dk, DNS:mailcloud.dk',
host: 'smtp.companyname.dk.',
cert:
{ subject: { OU: 'Domain Control Validated', CN: '*.mailcloud.dk' },
issuer: { O: 'AlphaSSL', CN: 'AlphaSSL CA - G2' },
subjectaltname: 'DNS:*.mailcloud.dk, DNS:mailcloud.dk',
infoAccess: { 'CA Issuers - URI': [Object], 'OCSP - URI': [Object] },
modulus: 'AFFDE405E26382FC1F9A126B51C763A21DCB90228DF9B9BFF466B00DA17BCBDA48E0315E0A6E4E8E0C65B3E5A9BF9A98448DF8006869B913C8D644B78B2176C240AA703DF7C5109F7FC9EDBAE0A69E35E00A81D753990A7DF531CC1F47A778A1CC18271298DBB71E341E846139951D9B119C237BDD9AA6F7D16A62FC5D4D6BEA0288DAC700E5C87E472B75365C522B0342185F16854659EE48637B6124269C4E18CC040344928D115350805EF66738922230349DEC97E2D68D0B4175EA6B63BC161B841C150B7009AAC0E8A06CD34D3912926D98CEBF83F6C187AD08A5045F9868512EFDD478FAA81FA0402F5C44B3FD70F82BA4F102352A01B02B77F0FA096D',
exponent: '10001',
valid_from: 'Oct 3 08:22:02 2014 GMT',
valid_to: 'Dec 21 11:07:29 2017 GMT',
fingerprint: '35:3A:87:5C:91:8C:B2:7C:4E:87:D1:E3:26:84:57:E5:A1:73:62:F3',
ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ],
serialNumber: '****',
raw: <Buffer 30 82 04 a7 30 82 03 8f a0 03 02 01 02 02 12 11 21 75 e4 f8 11 73 a4 c5 05 36 5f fe 9b b3 0b 4f 86 30 0d 06 09 2a 86 48 86 f7 0d 01 01 05 05 00 30 2e ... > } }
I've been stuck with this for days now and looked everywhere, so I hope somebody can help me with this (or at least point at the right direction).