Skip to content

Instantly share code, notes, and snippets.

@ehgoodenough
Last active August 29, 2015 14:03
Show Gist options
  • Save ehgoodenough/260bd7363660365cb752 to your computer and use it in GitHub Desktop.
Save ehgoodenough/260bd7363660365cb752 to your computer and use it in GitHub Desktop.
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: "do-not-reply@fake.com",
to: "some-person@aol.lol.com",
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