Monday, 12 June 2017

Having an issue with nodemailer and postfix

I'm receiving this error when I try to run nodemailer

{ Error: 139776600639296:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:794:
code: 'ECONNECTION', command: 'CONN' }

as shown in this snippet

'use strict';
const nodemailer = require('nodemailer');

// create reusable transporter object using the default SMTP transport
let transporter = nodemailer.createTransport({
    host: 'smtp.localhost',
    port: 465,
    secure: true, // secure:true for port 465, secure:false for port 587
});

// setup email data with unicode symbols
let mailOptions = {
    from: '"Fred Foo 👻" <foo@blurdybloop.com>', // sender address
    to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
    subject: 'Hello ✔', // Subject line
    text: 'Hello world ?', // plain text body
    html: '<b>Hello world ?</b>' // html body
};

// send mail with defined transport object
transporter.sendMail(mailOptions, (error, info) => {
    if (error) {
        return console.log(error);
    }
    console.log('Message %s sent: %s', info.messageId, info.response);
});

I cannot figure out here I'm going wrong with this. I left off the auth info on purpose as it said it would assume it had been authenticated already. Any help would be greatly appreciated - I've been scratching my head at this for days. Thanks!



via Zach Hill

No comments:

Post a Comment