Skip to content

Instantly share code, notes, and snippets.

@alexandermckay
Created October 19, 2019 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandermckay/cf45caf7f39a94f2d9864ab47aa4b285 to your computer and use it in GitHub Desktop.
Save alexandermckay/cf45caf7f39a94f2d9864ab47aa4b285 to your computer and use it in GitHub Desktop.
dynamic-content.js
const mailOptions = ({ subject, name, message }) => {
const text = `
Name: ${name}
Message: ${message}
`;
const html = `
<h1>Name: ${name}</h1>
<p>Message: ${message}</p>
`;
return {
from: sender,
to: recipient,
subject,
text,
html,
};
};
const handleEmail = (req, res) => {
transporter.sendMail(mailOptions(req.query), transport);
res.send({ status: 200 });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment