This commit is contained in:
Martin Donnelly 2016-02-12 10:47:52 +00:00
parent af48d9d469
commit 1c84148af2
2 changed files with 7 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* Created by marti on 30/01/2016. * Created by marti on 30/01/2016.
*/ */
var http = require('http'), request = require('request'), cheerio = require('cheerio'), Forecast = require('forecast.io'), util = require('util'), UltraSES = require('ultrases'), cron = require('node-cron'); var http = require('http'), request = require('request'), cheerio = require('cheerio'), Forecast = require('forecast.io'), util = require('util'), UltraSES = require('ultrases'), cron = require('node-cron');
var jade = require('jade'), _ = require('lodash'); var jade = require('jade'), _ = require('lodash'), dateFormat = require('dateformat');
var jsonfile = require('jsonfile'); var jsonfile = require('jsonfile');
var todayCache = { var todayCache = {
@ -203,12 +203,15 @@ module.exports = {
; ;
function sendEmail() { function sendEmail() {
var now = new Date();
var email = { var email = {
to: 'martind2000@gmail.com', to: 'martind2000@gmail.com',
subject: 'Today' subject: 'Today - ' + dateFormat(now, "dddd, mmmm dS, yyyy")
}; };
var template = {file: 'jade/today.jade', locals: todayCache}; var template = {file: 'lib/jade/today.jade', locals: todayCache};
mailer.sendTemplate(email, template, function (err) { mailer.sendTemplate(email, template, function (err) {
if (err) throw err; if (err) throw err;
console.log('compiled template email sent'); console.log('compiled template email sent');

View File

@ -3,6 +3,7 @@
"version": "0.1.1", "version": "0.1.1",
"devDependencies": { "devDependencies": {
"cheerio": "^0.19.0", "cheerio": "^0.19.0",
"dateformat": "^1.0.12",
"ejs": "^2.3.4", "ejs": "^2.3.4",
"forecast.io": "0.0.9", "forecast.io": "0.0.9",
"htmlparser": "^1.7.7", "htmlparser": "^1.7.7",