P
P
p3trukh1n2020-05-29 20:00:21
Email
p3trukh1n, 2020-05-29 20:00:21

NodeJS Why doesn't SMTP server work with secure option?

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);

Without secure and, accordingly, port 25, everything works, but it doesn’t.
I received the certificate in let's encrypt via certbot, I also tried not to install it separately and leave it by default, but everything is empty there too.

With secure enabled, sent for verification (mxtoolbox.com) <- here and (check.smtp.bz) <- here, in both cases it returned "Unable to connect (address)"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question