This minimal code to run an SMTP server works fine. When I send an email to my server, everything (because of the logger option) is logged as expected, and the email data is received.
const {SMTPServer} = require("smtp-server");
const {simpleParser} = require("mailparser");
const server = new SMTPServer({
authOptional: true,
onData: async (stream, session, callback) => {
const parsed = await simpleParser(stream);
callback();
console.log(parsed);
},
logger: true
});
server.listen(8025);
However, when I enable TLS options, sending an email to my server no longer logs anything. I don't even receive a connection, according to the logs.
const fs = require("fs");
const {SMTPServer} = require("smtp-server");
const {simpleParser} = require("mailparser");
const server = new SMTPServer({
secure: true,
authOptional: true,
onData: async (stream, session, callback) => {
const parsed = await simpleParser(stream);
callback();
console.log(parsed);
},
key: fs.readFileSync("privkey.pem"),
cert: fs.readFileSync("cert.pem"),
ca: fs.readFileSync("chain.pem"),
logger: true
});
server.listen(8025);
I think the certificate files are correct because I use them for my web server as well as my Postfix configuration, on the same domain, and HTTP/SMTP-out works fine and securely. I just can't receive email securely because of this issue.
What is going on here? Am I doing something wrong?
from Node `smtp-server` module won't work with TLS
No comments:
Post a Comment