Closed adminJVI closed 1 year ago
Using SMTP Test I have been testing my smtp server, The email is received but then it throws this error
<< 220 mail.whytewebart.com ESMTP >> EHLO [172.31.11.248] << 250-mail.host.com Nice to meet you, ec2-54-212-131-181.us-west-2.compute.amazonaws.com << 250-PIPELINING << 250-8BITMIME << 250-SMTPUTF8 << 250 AUTH LOGIN PLAIN >> AUTH PLAIN AGVtbWFudWVsQHdoeXRld2ViYXJ0LmNvbQB3aHl0ZTUwLnI1 << 235 Authentication successful >> MAIL FROM:<user@host.com> >> RCPT TO:<user@host.com> << 250 Accepted << 250 Accepted >> DATA << 354 End data with <CR><LF>.<CR><LF> >> From: user@host.com >> Date: Sun, 09 Apr 2023 15:08:59 퍍 >> Subject: SMTP test from mail.host.com >> Message-Id: <YCTFCN55NJU4.7U2GAJ9KNZ4A1@WIN-AUIR3RRGP88> >> To: user@host.com >> MIME-Version: 1.0 >> Content-Type: multipart/alternative; boundary="=-sRnPrL0YZzLDStyDxaSe3g==" >> >> --=-sRnPrL0YZzLDStyDxaSe3g== >> Content-Type: text/plain; charset=utf-8 >> >> Test message >> --=-sRnPrL0YZzLDStyDxaSe3g== >> Content-Type: text/html; charset=utf-8 >> Content-Id: <YCTFCN55NJU4.JBXYSI2FKA2Y@WIN-AUIR3RRGP88> >> >> <b>Test message</b> >> --=-sRnPrL0YZzLDStyDxaSe3g==-- >> . << 421 Timeout - closing connection >> RSET ERROR: Timeout - closing connection
I honestly don't understand what's going on anymore, My DNS is properly set up, with the exception of dkims keys. Here is my code
dkims keys
const server = new SMTPServer({ logger: true, secure: true, ca: [fs.readFileSync(`${fastify.dirname()}/private.key`), fs.readFileSync(`${fastify.dirname()}/server.csr`),], keepAlive: true, onAuth(auth, session, callback) { let username = 'user@host.com'; let password = 'passcode'; // check username and password if ( auth.username === username && (auth.method === 'CRAM-MD5' ? auth.validatePassword(password) // if cram-md5, validate challenge response : auth.password === password) // for other methods match plaintext passwords ) { return callback(null, { user: 'userdata' // }); } return callback(new Error('Authentication failed')); }, onData(stream, session, callback) { simpleParser(stream, {}, (err, parsed) => { if (err) console.log("Error:", err) console.log(parsed); console.log(chalk.redBright("Recieved an email right about now")) // stream.on("end", callback) }) }, onConnect(session, callback) { console.log("SMTP connection established."); callback(null); }, onClose(session, callback) { console.log("SMTP connection closed."); } }); server.on("error", err => { console.log("Error %s", err.message); }); server.listen(465, () => { console.log(chalk.yellowBright("started smtp server")) })
The server is being hosted on Digital ocean, using Nginx proxy, Nodejs version v16.13.1, Pm2 to keep the server going.
v16.13.1
onData callback is never called
Using SMTP Test I have been testing my smtp server, The email is received but then it throws this error
I honestly don't understand what's going on anymore, My DNS is properly set up, with the exception of
dkims keys
. Here is my codeThe server is being hosted on Digital ocean, using Nginx proxy, Nodejs version
v16.13.1
, Pm2 to keep the server going.