Permalink
Browse files

Added inReplyTo and References support

  • Loading branch information...
1 parent afe7150 commit f5373118982fc213a48eac8d64d617d56d044331 Andris Reinman committed Jul 17, 2012
Showing with 35 additions and 7 deletions.
  1. +2 −0 README.md
  2. +1 −1 lib/nodemailer.js
  3. +2 −2 package.json
  4. +30 −4 test/nodemailer.js
View
@@ -368,6 +368,8 @@ The following are the possible fields of an e-mail message:
- **cc** - Comma separated list of recipients e-mail addresses that will appear on the `Cc:` field
- **bcc** - Comma separated list of recipients e-mail addresses that will appear on the `Bcc:` field
- **replyTo** - An e-mail address that will appear on the `Reply-To:` field
+ - **inReplyTo** - The message-id this message is replying
+ - **references** - Message-id list
- **subject** - The subject of the e-mail
- **text** - The plaintext version of the message
- **html** - The HTML version of the message
View
@@ -207,7 +207,7 @@ Nodemailer.prototype.setGeneralOptions = function(){
var acceptedFields = ["from", "sender", "to", "subject", "replyTo", "debug",
"reply_to", "cc", "bcc", "body", "text", "html",
- "envelope"],
+ "envelope", "inReplyTo", "references"],
mailOptions = {},
keys = Object.keys(this.options),
key;
View
@@ -1,7 +1,7 @@
{
"name": "nodemailer",
"description": "Easy to use module to send e-mails, supports unicode and SSL/TLS",
- "version": "0.3.20",
+ "version": "0.3.21",
"author" : "Andris Reinman",
"maintainers":[
{
@@ -25,7 +25,7 @@
}
],
"dependencies": {
- "mailcomposer": ">= 0.1.14",
+ "mailcomposer": ">= 0.1.15",
"simplesmtp": ">= 0.1.15"
},
"devDependencies": {
View
@@ -55,8 +55,8 @@ exports["General tests"] = {
transport.sendMail(mailOptions, function(error, response){
test.ifError(error);
- var regex = "Message\\-Id:\\s*<[0-9\.a-fA-F]+@"+nodemailer.X_MAILER_NAME.replace(/([\(\)\\\.\[\]\-\?\:\!\{\}])/g, "\\$1")+">";
- test.ok(response.message.match(new RegExp(regex)));
+ var regex = "^Message\\-Id:\\s*<[0-9\.a-fA-F]+@"+nodemailer.X_MAILER_NAME.replace(/([\(\)\\\.\[\]\-\?\:\!\{\}])/g, "\\$1")+">$";
+ test.ok(response.message.match(new RegExp(regex, "m")));
test.done();
})
},
@@ -71,8 +71,34 @@ exports["General tests"] = {
test.ifError(error);
test.ok(response.message.match(/Message\-Id:\s*<ABCDEF>/));
// default not present
- var regex = "Message\\-Id:\\s*<[0-9\.a-fA-F]+@"+nodemailer.X_MAILER_NAME.replace(/([\(\)\\\.\[\]\-\?\:\!\{\}])/g, "\\$1")+">";
- test.ok(!response.message.match(new RegExp(regex)));
+ var regex = "^Message\\-Id:\\s*<[0-9\.a-fA-F]+@"+nodemailer.X_MAILER_NAME.replace(/([\(\)\\\.\[\]\-\?\:\!\{\}])/g, "\\$1")+">$";
+ test.ok(!response.message.match(new RegExp(regex, "m")));
+ test.done();
+ })
+ },
+
+ "Use In-Reply-To": function(test){
+ var transport = nodemailer.createTransport("Stub"),
+ mailOptions = {
+ inReplyTo: "abc"
+ };
+
+ transport.sendMail(mailOptions, function(error, response){
+ test.ifError(error);
+ test.ok(response.message.match(/^In\-Reply\-To:\s*<abc>$/m));
+ test.done();
+ })
+ },
+
+ "Use References": function(test){
+ var transport = nodemailer.createTransport("Stub"),
+ mailOptions = {
+ references: ["abc def <ghi>", "jkl"]
+ };
+
+ transport.sendMail(mailOptions, function(error, response){
+ test.ifError(error);
+ test.ok(response.message.match(/^References:\s*<abc> <def> <ghi> <jkl>$/m));
test.done();
})
},

0 comments on commit f537311

Please sign in to comment.