Skip to content

Loading…

Always add a Date: header since that is required by RFC2822 #45

Merged
merged 3 commits into from

3 participants

@jimmybergman

In addition, if the user previously specified Date, that will override the default

@travisbot

This pull request passes (merged 81285aa into c1e2cd0).

@eleith
Owner

thanks for pointing this out. i prefer to use moment.js when it comes to date formatting in javascript, if you wouldn't mind using that instead, i'll take the patch directly

http://momentjs.com/docs/#/use-it/in-nodejs/

let me know if that sounds good to you or not. thanks again for proposing this.

@travisbot

This pull request passes (merged 728e664 into c1e2cd0).

@jimmybergman

@eleith no problem, updated to use moment.js instead

@eleith eleith commented on the diff
package.json
((6 lines not shown))
"repository":
{
"type": "git",
"url": "http://github.com/eleith/emailjs.git"
},
- "devDependencies":
@eleith Owner
eleith added a note

could you split these up?

devDependencies are for packages needed for running the tests, dependencies are for packages needed to run the module itself. i don't want to force people to install chai, mocha, etc etc just to run the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@eleith eleith merged commit 728e664 into eleith:master

1 check passed

Details default The Travis build passed
@eleith
Owner

thanks again. merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 4 deletions.
  1. +4 −3 package.json
  2. +6 −1 smtp/message.js
View
7 package.json
@@ -3,19 +3,20 @@
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server",
"version": "0.3.1",
"author": "eleith",
- "contributors":["izuzak", "Hiverness", "mscdex"],
+ "contributors":["izuzak", "Hiverness", "mscdex", "jimmybergman"],
"repository":
{
"type": "git",
"url": "http://github.com/eleith/emailjs.git"
},
- "devDependencies":
@eleith Owner
eleith added a note

could you split these up?

devDependencies are for packages needed for running the tests, dependencies are for packages needed to run the module itself. i don't want to force people to install chai, mocha, etc etc just to run the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ "dependencies":
{
"mocha": ">= 1.2.2",
"chai": ">= 1.1.0",
"simplesmtp": ">= 0.1.18",
"mailparser": "0.2.27",
- "iconv": "1.1.3"
+ "iconv": "1.1.3",
+ "moment" : ">= 1.7.0"
},
"optionalDependencies":
{
View
7 smtp/message.js
@@ -3,6 +3,7 @@ var util = require('util');
var fs = require('fs');
var os = require('os');
var path = require('path');
+var moment = require('moment');
var CRLF = "\r\n";
var MIMECHUNK = 76; // MIME standard wants 76 char chunks when sending out.
var BASE64CHUNK= 24; // BASE64 bits needed before padding is used
@@ -31,7 +32,11 @@ var Message = function(headers)
{
this.attachments = [];
this.alternative = null;
- this.header = {"message-id":"<" + (new Date()).getTime() + "." + (counter++) + "." + process.pid + "@" + os.hostname() +">"};
+ var now = new Date();
+ this.header = {
+ "message-id":"<" + now.getTime() + "." + (counter++) + "." + process.pid + "@" + os.hostname() +">",
+ "date":moment().format("ddd, DD MMM YYYY HH:mm:ss ZZ")
+ };
this.content = "text/plain; charset=utf-8";
for(var header in headers)
Something went wrong with that request. Please try again.