Created
July 16, 2015 02:17
-
-
Save kurtisdunn/7d184f6b077e601becd2 to your computer and use it in GitHub Desktop.
Node Mailer - ExpressJS
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 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 + ' <[email protected]>', | |
to: '[email protected]', | |
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