mirror of
https://github.com/eleith/emailjs.git
synced 2024-07-05 20:10:37 +00:00
force close smtp on auth failure, so all callbacks get called
This commit is contained in:
parent
8fdcab32d8
commit
89267deb7a
@ -50,8 +50,13 @@ Client.prototype =
|
||||
self.ready = true;
|
||||
self._poll();
|
||||
}
|
||||
else
|
||||
else {
|
||||
stack.callback(err, stack.message);
|
||||
|
||||
// clear out the queue so all callbacks can be called with the same error message
|
||||
self.queue.shift();
|
||||
self._poll();
|
||||
}
|
||||
};
|
||||
|
||||
if(!self.smtp.authorized())
|
||||
@ -60,8 +65,13 @@ Client.prototype =
|
||||
else
|
||||
self.smtp.ehlo_or_helo_if_needed(begin);
|
||||
}
|
||||
else
|
||||
else {
|
||||
stack.callback(err, stack.message);
|
||||
|
||||
// clear out the queue so all callbacks can be called with the same error message
|
||||
self.queue.shift();
|
||||
self._poll();
|
||||
}
|
||||
};
|
||||
|
||||
self.ready = false;
|
||||
@ -86,9 +96,9 @@ Client.prototype =
|
||||
{
|
||||
var stack =
|
||||
{
|
||||
message: msg,
|
||||
message: msg,
|
||||
to: address.parse(msg.header.to),
|
||||
from: address.parse(msg.header.from)[0].address,
|
||||
from: address.parse(msg.header.from)[0].address,
|
||||
callback: callback || function() {}
|
||||
};
|
||||
|
||||
|
@ -439,6 +439,7 @@ SMTP.prototype = {
|
||||
// handle bad responses from command differently
|
||||
var failed = function(err, data) {
|
||||
self.loggedin = false;
|
||||
self.close(); // if auth is bad, close the connection, it won't get better by itself
|
||||
caller(callback, SMTPError('authorization.failed', SMTPError.AUTHFAILED, err, data));
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user