Created
February 4, 2016 22:24
-
-
Save jondcallahan/2419f8c3f35766da32de to your computer and use it in GitHub Desktop.
Send an html email from the command line via Mandrill. Useful for rapidly testing html emails.
This file contains 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 email = require('mandrill-send')('MANDRILL_API_KEY'); | |
var fs = require('fs'); | |
require.extensions['.html'] = function (module, filename) { | |
module.exports = fs.readFileSync(filename, 'utf8'); | |
}; | |
var htmlEmail = require("PATH_TO_FILE.HTML"); | |
email({ | |
from: 'FROM_NAME <[email protected]>', | |
to: [{ name: 'TO_NAME', email: '[email protected]' }], | |
subject: Date(), | |
html: htmlEmail | |
}, function(err){ | |
if (err) console.error(err); | |
console.log('Sent!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment