Guest User

Untitled

a guest
Jan 10th, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. const nodemailer = require('nodemailer')
  2.  
  3. module.exports = async (to, content) => {
  4.  
  5. const credentials = {
  6. host: 'smtp.gmail.com',
  7. port: 465,
  8. auth: {
  9. user: process.env.MAIL_USER,
  10. pass: process.env.MAIL_PASS
  11. }
  12. }
  13.  
  14. const contacts = {
  15. from: process.env.MAIL_USER,
  16. to
  17. }
  18.  
  19. const mailContent = Object.assign({}, content, contacts)
  20.  
  21. const transporter = nodemailer.createTransport(credentials)
  22. await transporter.sendMail(mailContent)
  23.  
  24. }
Add Comment
Please, Sign In to add comment