Comparing version 0.2.8 to 0.2.9
{ | ||
"name": "emailjs", | ||
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"author": "eleith", | ||
@@ -14,3 +14,6 @@ "contributors":["izuzak", "Hiverness", "mscdex"], | ||
{ | ||
"prompt": ">= 0.1.10" | ||
"mocha": ">= 1.0.3", | ||
"chai": ">= 1.0.3", | ||
"simplesmtp" : ">= 0.1.18", | ||
"mailparser" : ">= 0.2.26" | ||
}, | ||
@@ -25,4 +28,4 @@ "dependencies": | ||
{ | ||
"test": "node test/run.js" | ||
"test": "mocha -R spec -t 5000 test/*.js" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# emailjs (v0.2.7) | ||
# emailjs (v0.2.9) | ||
@@ -53,3 +53,3 @@ send emails, html and attachments (files, streams and strings) from node.js to any smtp server | ||
var headers = { | ||
var message = { | ||
text: "i hope this works", | ||
@@ -59,14 +59,10 @@ from: "you <username@gmail.com>", | ||
cc: "else <else@gmail.com>", | ||
subject: "testing emailjs" | ||
subject: "testing emailjs", | ||
attachment: | ||
[ | ||
{data:"<html>i <i>hope</i> this works!</html>", alternative:true}, | ||
{path:"path/to/file.zip", type:"application/zip", name:"renamed.zip"} | ||
] | ||
}; | ||
// create the message | ||
var message = email.message.create(headers); | ||
// attach an alternative html email for those with advanced email clients | ||
message.attach({data:"<html>i <i>hope</i> this works!</html>", alternative:true}); | ||
// attach attachments because you can! | ||
message.attach({path:"path/to/file.zip", type:"application/zip", name:"renamed.zip"}); | ||
// send the message and get a callback with an error or details of the message that was sent | ||
@@ -106,3 +102,3 @@ server.send(message, function(err, message) { console.log(err || message); }); | ||
## email.message.create(headers) | ||
## message | ||
@@ -123,5 +119,6 @@ // headers is an object ('from' and 'to' are required) | ||
subject // string subject of the email | ||
attachment // one attachment or array of attachments | ||
} | ||
## Message.attach(options) | ||
## attachment | ||
@@ -128,0 +125,0 @@ // can be called multiple times, each adding a new attachment |
@@ -122,3 +122,3 @@ var smtp = require('./smtp'); | ||
// but first reset SMTP state so queue can continue polling | ||
self.smtp.rset(function(err) { self._senddone(err, stack); }); | ||
self.smtp.rset(function() { self._senddone(err, stack); }); | ||
} | ||
@@ -125,0 +125,0 @@ }; |
@@ -43,2 +43,18 @@ var stream = require('stream'); | ||
} | ||
else if(header == "attachment" && typeof (headers[header]) == "object") | ||
{ | ||
if((headers[header]).constructor == Array) | ||
{ | ||
var that = this; | ||
headers[header].forEach(function(attachment) | ||
{ | ||
that.attach(attachment); | ||
}); | ||
} | ||
else | ||
{ | ||
this.attach(headers[header]); | ||
} | ||
} | ||
else | ||
@@ -45,0 +61,0 @@ { |
@@ -78,4 +78,4 @@ /* | ||
// keep these strings hidden when quicky debugging/logging | ||
this.user = function() { return options.user; } | ||
this.password = function() { return options.password; } | ||
this.user = function() { return options.user; }; | ||
this.password = function() { return options.password; }; | ||
}; | ||
@@ -515,3 +515,16 @@ | ||
}; | ||
var attempt_user = function(err, data, msg) | ||
{ | ||
if(err) | ||
{ | ||
failed(err, data); | ||
} | ||
else | ||
{ | ||
if(method == AUTH_METHODS.LOGIN) | ||
self.command((new Buffer(login.user())).toString("base64"), attempt, [334]); | ||
} | ||
}; | ||
if(method == AUTH_METHODS.CRAM_MD5) | ||
@@ -521,3 +534,3 @@ self.command("AUTH " + AUTH_METHODS.CRAM_MD5, attempt, [334]); | ||
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, attempt_user, [334]); | ||
@@ -524,0 +537,0 @@ else if(method == AUTH_METHODS.PLAIN) |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
3937204
1896
3
4
155