Skip to content
Browse files

Better error support

  • Loading branch information...
1 parent 4dbb36a commit e834625a88e3e6f8986a1df5144809ca59e556d7 andris9 committed Aug 5, 2011
Showing with 15 additions and 1 deletion.
  1. +14 −0 lib/smtp.js
  2. +1 −1 package.json
View
14 lib/smtp.js
@@ -200,6 +200,12 @@ SMTPClient.prototype._flushMessages = function() {
var address;
if(i === toAddress.length) {
smtp.send("DATA",function(error, message) {
+ if(error){
+ smtp.close();
+ return process.nextTick(function(){
+ callback && callback(error, null);
+ });
+ }
process.nextTick(sendBody);
});
}else{
@@ -569,6 +575,14 @@ SMTPClient.prototype._handshake = function(callback){
this._sendCommand("EHLO "+this.hostname, (function(error, data){
if(error){
+ if(error.message && error.message.match(/^421/)){
+ smtp.close();
+ process.nextTick(function(){
+ callback && callback(error, null);
+ });
+ return;
+ }
+
// fallback to HELO
return this._sendCommand("HELO "+this.hostname, (function(error, data){
if(error){
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "nodemailer",
"description": "Easy to use module to send e-mails, supports unicode and SSL/TLS",
- "version": "0.1.23",
+ "version": "0.1.24",
"author" : "Andris Reinman",
"maintainers":[
{

0 comments on commit e834625

Please sign in to comment.
Something went wrong with that request. Please try again.