Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "emailjs", | ||
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": "eleith", | ||
@@ -6,0 +6,0 @@ "contributors":["izuzak", "Hiverness", "mscdex"], |
@@ -1,2 +0,2 @@ | ||
# emailjs (v0.2.1) | ||
# emailjs (v0.2.2) | ||
@@ -3,0 +3,0 @@ send emails, html and attachments (files, streams and strings) from node.js to any smtp server |
@@ -22,4 +22,2 @@ /* | ||
var DEBUG = 0; | ||
var SMTP_USER = null; | ||
var SMTP_PASSWORD = null; | ||
@@ -80,5 +78,5 @@ var log = function() | ||
// keep private | ||
SMTP_USER = options.user; | ||
SMTP_PASSWORD = options.password; | ||
// keep these strings hidden when quicky debugging/logging | ||
this.user = function() { return options.user; } | ||
this.password = function() { return options.password; } | ||
}; | ||
@@ -422,4 +420,4 @@ | ||
{ | ||
user: user || SMTP_USER, | ||
password: password || SMTP_PASSWORD, | ||
user: user ? function() { return user; } : self.user, | ||
password: password ? function() { return password; } : self.password, | ||
method: options && options.method ? options.method.toUpperCase() : '' | ||
@@ -457,6 +455,6 @@ }, | ||
var hmac = crypto.createHmac('md5', login.password); | ||
var hmac = crypto.createHmac('md5', login.password()); | ||
hmac.update(challenge); | ||
return (new Buffer(login.user + " " + hmac.digest('hex')).toString("base64")); | ||
return (new Buffer(login.user() + " " + hmac.digest('hex')).toString("base64")); | ||
}, | ||
@@ -466,3 +464,3 @@ | ||
{ | ||
return (new Buffer("\\0" + login.user + "\\0" + login.password)).toString("base64"); | ||
return (new Buffer("\\0" + login.user() + "\\0" + login.password())).toString("base64"); | ||
}; | ||
@@ -518,3 +516,3 @@ | ||
else if(method == AUTH_METHODS.LOGIN) | ||
self.command((new Buffer(login.password)).toString("base64"), response, [235, 503]); | ||
self.command((new Buffer(login.password())).toString("base64"), response, [235, 503]); | ||
} | ||
@@ -527,6 +525,6 @@ }; | ||
else if(method == AUTH_METHODS.LOGIN) | ||
self.command("AUTH " + AUTH_METHODS.LOGIN + " " + (new Buffer(login.user)).toString("base64"), attempt, [334]); | ||
self.command("AUTH " + AUTH_METHODS.LOGIN + " " + (new Buffer(login.user())).toString("base64"), attempt, [334]); | ||
else if(method == AUTH_METHODS.PLAIN) | ||
self.command("AUTH " + AUTH_METHODS.PLAIN + " " + encode_plain(login.user, login.password), response, [235, 503]); | ||
self.command("AUTH " + AUTH_METHODS.PLAIN + " " + encode_plain(login.user(), login.password()), response, [235, 503]); | ||
@@ -566,3 +564,3 @@ else if(!method) | ||
this.features = null; | ||
this.loggedin = (SMTP_USER && SMTP_PASSWORD) ? false : true; | ||
this.loggedin = !(this.user() && this.password()); | ||
}, | ||
@@ -569,0 +567,0 @@ |
3934554
1806