Skip to content

Instantly share code, notes, and snippets.

@kurtisdunn
Created July 16, 2015 02:17
Show Gist options
  • Select an option

  • Save kurtisdunn/7d184f6b077e601becd2 to your computer and use it in GitHub Desktop.

Select an option

Save kurtisdunn/7d184f6b077e601becd2 to your computer and use it in GitHub Desktop.
Node Mailer - ExpressJS
var nodemailer = require('nodemailer');
app.post('/mail', function(req, res) {
// Initial REST load
// create reusable transporter object using SMTP transport
var transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: '<<username>>',
pass: '<<password>>'
}
});
console.log('req.params: ', req.params)
// setup e-mail data with unicode symbols
var mailOptions = {
from: req.params.name + ' <foo@blurdybloop.com>',
to: 'contact@uxconsulting.com.au',
subject: 'Hello from your website',
html: '<b>Hello world </b>'
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment