Skip to content

Instantly share code, notes, and snippets.

/index.js Secret

Created March 29, 2016 09:15
Show Gist options
  • Save anonymous/ba82f74071cc38a0700b to your computer and use it in GitHub Desktop.
Save anonymous/ba82f74071cc38a0700b to your computer and use it in GitHub Desktop.
const post = {name: results.name, email: results.email, subject: results.subject, message: results.message},
transporter = nodemailer.createTransport({
service: 'Gmail',
host: 'myhost.com',
port: 80,
secure: true,
auth: {
user: 'myemail@gmail.com',
pass: 'mypassword'
}
}),
mailOptions = {
from: 'sender@gmail.com',
to: 'receiver@gmail.com',
subject: 'You received a new message at !',
text: `Name: ${results.name} \n\nEmail: ${results.email} \n\nSubject: ${results.subject} \n\nMessage: ${results.message}`,
html: ''
}
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.log(error)
} else {
console.log('Message sent: ' + info.response)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment