Guest User

Untitled

a guest
Jun 28th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. const nodemailer = require('nodemailer');
  2.  
  3. // create reusable transporter object using SMTP transport
  4. const
  5. transporter = nodemailer.createTransport({
  6. service: 'Gmail',
  7. auth: {
  8. user: 'gmail.user@gmail.com',
  9. pass: 'userpass'
  10. }
  11. });
  12.  
  13. // setup e-mail data with unicode symbols
  14. const mailOptions = {
  15. from: 'Tutti Frutti ✔ <tuttifrutti@gmail.com>', // sender address
  16. to: 'user@tuttifrutti.com, user2@tuttifrutti.com', // list of receivers always separated by ","
  17. subject: 'Hello ✔', // Subject line
  18. text: 'Hello world ✔', // plaintext body
  19. html: '<b>Hello world ✔</b>' // html body
  20. };
  21.  
  22. // send mail with defined transport object
  23. transporter.sendMail(mailOptions, function(error, info){
  24. if(error){
  25. console.log(error);
  26. }else{
  27. console.log('Message sent: ' + info.response);
  28. }
  29. });
Add Comment
Please, Sign In to add comment