node.js - NodeJS SimpleSMTP -
i utilize simplesmpt smpt server. want create error answers. illustration when user seek auth want write "user doesnot exists" or "account banned". server.js , find code send client answers. how can send answer?
this.client.send("535 5.7.8 error: authentication failed: no mechanism available");
this part of code server.js. how alter answers script , generate own answers?
if understand correctly, want custom error message sent when user fails authentication. there shouldn't need edit simplesmtp source code.
when creating simple smtp server instance, set requireauthentication
true
, add together event handler function authorizeuser
.
example code mockup:
var options = { ... requireauthentication: true }; var smtp = simplesmtp.createserver(); smtp.listen(25); smtp.on("authorizeuser", function (connection, username, password, callback) { // custom asynchronous validation function userisnotauthorized(function(isvalidated){ if(isvalidated) { homecoming callback(new error("535 5.7.8 error: authentication failed: no mechanism available", false); } callback(null, true); }); });
node.js smtp
No comments:
Post a Comment