Skip to content

Instantly share code, notes, and snippets.

@juliojgarciaperez
Created July 17, 2018 17:46
Show Gist options
  • Save juliojgarciaperez/8bc169ff9775ac9da80598d020b515a0 to your computer and use it in GitHub Desktop.
Save juliojgarciaperez/8bc169ff9775ac9da80598d020b515a0 to your computer and use it in GitHub Desktop.
Simple mailer service example
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: process.env.EMAIL_SENDER,
pass: process.env.EMAIL_PASSWORD
}
});
const defaultFrom = process.env.EMAIL_SENDER
module.exports.confirmSignUp = (user) => {
return transporter.sendMail({
from: defaultFrom,
to: user.email,
subject: 'Confirm SignUp!',
html: `
<!DOCTYPE html>
<html>
<head>
</head>
<body>
...
</body>
</html>
`
});
}
module.exports.helpRequest = (to, content) => {
return transporter.sendMail({
from: defaultFrom,
to: to,
subject: 'Welcome!',
html: `
<!DOCTYPE html>
<html>
<head>
</head>
<body>
...
</body>
</html>
`
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment