Last active
August 29, 2015 14:03
-
-
Save ehgoodenough/260bd7363660365cb752 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mailer = require("nodemailer"); | |
var scheduler = require("node-schedule"); | |
scheduler.scheduleJob({hour: 0, minute: 0}, function() //runs this function every morning at midnight. | |
{ | |
var transport = mailer.createTransport("SMTP", {service: "gmail", auth: require("./gmail.auth.js")}); | |
var settings = { | |
from: "[email protected]", | |
to: "[email protected]", | |
subject: "Check it out!", | |
text: "I sent this automatically! How cool!", | |
html: "I sent this automatically! <b>How cool!</b>" | |
} | |
transport.sendMail(settings, function(error, response) | |
{ | |
if(error) | |
{ | |
console.log(error); | |
} | |
else | |
{ | |
console.log(response.message); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment