nodemailer / smtp-server

Create custom SMTP servers on the fly
Other
846 stars 145 forks source link

NodeJS Why is not SMTP server work with secure option turned on? #152

Closed genialkartik closed 4 years ago

genialkartik commented 4 years ago

Without secure option and post 25 accordingly all works, but not with it.

The certificate I got using Let's Encrypt through the Certbot. And also I tried to remain default certificate, but it doesn't work that way either. I tested it using mxtoolbox's tool, and got the "Connection error" result

const fs = require('fs');
const {SMTPServer} = require('smtp-server');

const smtp = new SMTPServer({
    secure: true,
    key: fs.readFileSync('certs/privkey.pem'),
    cert: fs.readFileSync('certs/cert.pem'),
    onData,
    onRcptTo,
    authOptional: true,
});

function onRcptTo(address, session, callback) {
    console.log("IS HERE!!!");
    callback();
}

function onData(stream, session, callback) {
    stream.pipe(process.stdout);
}

smtp.listen(465);

So, why this happen?

andris9 commented 4 years ago

Duplicate of #151