Comparing version 0.3.8 to 0.3.9
{ | ||
"name": "emailjs", | ||
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"author": "eleith", | ||
@@ -25,3 +25,3 @@ "contributors":["izuzak", "Hiverness", "mscdex", "jimmybergman"], | ||
"chai": "= 1.1.0", | ||
"simplesmtp": "= 0.3.24", | ||
"simplesmtp": "0.3.32", | ||
"mailparser": "0.4.1", | ||
@@ -28,0 +28,0 @@ "iconv": "2.0.7" |
@@ -1,2 +0,2 @@ | ||
# emailjs (v0.3.8) [![Build Status](https://secure.travis-ci.org/eleith/emailjs.png)](http://travis-ci.org/eleith/emailjs) | ||
# emailjs [![Build Status](https://secure.travis-ci.org/eleith/emailjs.png)](http://travis-ci.org/eleith/emailjs) | ||
@@ -10,3 +10,3 @@ send emails, html and attachments (files, streams and strings) from node.js to any smtp server | ||
## FEATURES | ||
- works with SSL and TLS smtp servers (ex: gmail) | ||
- works with SSL and TLS smtp servers | ||
- supports smtp authentication (PLAIN, LOGIN, CRAMMD5) | ||
@@ -19,3 +19,4 @@ - emails are queued and the queue is sent asynchronously | ||
## REQUIRES | ||
- access to an SMTP Server (ex: gmail) | ||
- auth access to an SMTP Server | ||
- if your service (ex: gmail) uses two-step authentication, use an applicaiton specific password | ||
@@ -29,3 +30,3 @@ ## EXAMPLE USAGE - text only emails | ||
password:"password", | ||
host: "smtp.gmail.com", | ||
host: "smtp.your-email.com", | ||
ssl: true | ||
@@ -37,5 +38,5 @@ }); | ||
text: "i hope this works", | ||
from: "you <username@gmail.com>", | ||
to: "someone <someone@gmail.com>, another <another@gmail.com>", | ||
cc: "else <else@gmail.com>", | ||
from: "you <username@your-email.com>", | ||
to: "someone <someone@your-email.com>, another <another@your-email.com>", | ||
cc: "else <else@your-email.com>", | ||
subject: "testing emailjs" | ||
@@ -52,3 +53,3 @@ }, function(err, message) { console.log(err || message); }); | ||
password:"password", | ||
host: "smtp.gmail.com", | ||
host: "smtp.your-email.com", | ||
ssl: true | ||
@@ -59,5 +60,5 @@ }); | ||
text: "i hope this works", | ||
from: "you <username@gmail.com>", | ||
to: "someone <someone@gmail.com>, another <another@gmail.com>", | ||
cc: "else <else@gmail.com>", | ||
from: "you <username@your-email.com>", | ||
to: "someone <someone@your-email.com>, another <another@your-email.com>", | ||
cc: "else <else@your-email.com>", | ||
subject: "testing emailjs", | ||
@@ -95,4 +96,4 @@ attachment: | ||
from: "you <username@outlook.com>", | ||
to: "someone <someone@gmail.com>, another <another@gmail.com>", | ||
cc: "else <else@gmail.com>", | ||
to: "someone <someone@your-email.com>, another <another@your-email.com>", | ||
cc: "else <else@your-email.com>", | ||
subject: "testing emailjs", | ||
@@ -99,0 +100,0 @@ attachment: |
@@ -53,4 +53,9 @@ var smtp = require('./smtp'); | ||
} | ||
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(); | ||
} | ||
}; | ||
@@ -64,4 +69,9 @@ | ||
} | ||
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(); | ||
} | ||
}; | ||
@@ -91,5 +101,5 @@ | ||
{ | ||
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() {} | ||
@@ -104,2 +114,5 @@ }; | ||
if(msg.header['return-path'] && address.parse(msg.header['return-path']).length) | ||
stack.returnPath = address.parse(msg.header['return-path'])[0].address; | ||
self.queue.push(stack); | ||
@@ -157,4 +170,5 @@ self._poll(); | ||
var self = this; | ||
var from = stack.returnPath || stack.from; | ||
self.sending = true; | ||
self.smtp.mail(self._sendsmtp(stack, self._sendrcpt), '<' + stack.from + '>'); | ||
self.smtp.mail(self._sendsmtp(stack, self._sendrcpt), '<' + from + '>'); | ||
}, | ||
@@ -161,0 +175,0 @@ |
@@ -291,3 +291,3 @@ var stream = require('stream'); | ||
'content-transfer-encoding': 'base64', | ||
'content-disposition': attachment.inline ? 'inline' : 'attachment; filename="' + attachment.name + '"' | ||
'content-disposition': attachment.inline ? 'inline' : 'attachment; filename="' + mimelib.encodeMimeWord(attachment.name, 'Q', 'utf-8') + '"' | ||
}; | ||
@@ -294,0 +294,0 @@ |
@@ -108,3 +108,8 @@ /* | ||
if (self._state != SMTPState.NOTCONNECTED) self.quit(); | ||
if (self._state != SMTPState.NOTCONNECTED) { | ||
self.quit(function() { | ||
self.connect(callback, port, host, options); | ||
}); | ||
return; | ||
} | ||
@@ -140,4 +145,5 @@ var connected = function(err) { | ||
log("response (data): " + msg.data); | ||
self.quit(); | ||
caller(callback, SMTPError("bad response on connection", SMTPError.BADRESPONSE, err, msg.data)); | ||
self.quit(function() { | ||
caller(callback, SMTPError("bad response on connection", SMTPError.BADRESPONSE, err, msg.data)); | ||
}); | ||
} | ||
@@ -160,2 +166,3 @@ }; | ||
self.sock.once('response', response); | ||
self.sock.once('error', response); // the socket could reset or throw, so let's handle it and let the user know | ||
}, | ||
@@ -445,2 +452,3 @@ | ||
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)); | ||
@@ -447,0 +455,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58740
1612
184