You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Using the smtp-server listener Iam trying to receive mails. (But Authentication is not happening. Even emails are not detecting).
Please check the below code snippet that iam using and let me know if I have done any wrong.
(No consoles are printing expect console.log("starts listening on 465>>>") in the below code snippet).
var SMTPServer = require('smtp-server').SMTPServer;
var server = new SMTPServer({
tls:true,
logger: true,
onAuth(auth, session, callback) {
console.log("Console in auth function>>>",auth);
if (auth.username != config.mail_username || auth.password != config.mail_password) {
return callback(new Error("Invalid username or password"));
}
console.log("Authentication successfull>>>")
return callback();
},
onConnect(session, callback) {
console.log("Console in onConnect function>>>",session);
if (session.remoteAddress === "127.0.0.1") {
return callback(new Error("No connections from localhost allowed"));
}
return callback(); // Accept the connection
},
onMailFrom(address, session, callback) {
console.log("Received mail from function>>>",address);
if (address.address !== "[email protected]") {
return callback(
new Error("Only [email protected] is allowed to send mail")
);
}
return callback(); // Accept the address
},
onData(stream, session, callback) {
console.log("Console at onData function>>>",onData);
stream.pipe(process.stdout); // print message to console
stream.on("end", callback);
}
});
// mailListener.listen(465) // start listening
server.listen(465, function () {
console.log("starts listning on 465>>>")
})
server.on("error", err => {
console.log("Error %s", err.message);
});
server.on('error', err => {
console.log("Error on server start",err.message);
});
server.listen(465);
The text was updated successfully, but these errors were encountered:
vinodhreddygs
changed the title
Authentication is not happening
Received mails not detecting for the SMTP server in my application
Apr 23, 2020
Hi,
Using the smtp-server listener Iam trying to receive mails. (But Authentication is not happening. Even emails are not detecting).
Please check the below code snippet that iam using and let me know if I have done any wrong.
(No consoles are printing expect console.log("starts listening on 465>>>") in the below code snippet).
var SMTPServer = require('smtp-server').SMTPServer;
The text was updated successfully, but these errors were encountered: