Guest User

Untitled

a guest
Mar 5th, 2018
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. // main.js
  2. const nodemailer = require('nodemailer');
  3.  
  4. // setup mail transporter service
  5. const transporter = nodemailer.createTransport({
  6. service: 'hotmail',
  7. auth: {
  8. user: 'yourmail@hotmail.com', // your email
  9. pass: 'password' // your password
  10. }
  11. });
  12.  
  13. // setup email data with unicode symbols
  14. const mailOptions = {
  15. from: 'sender@hotmail.com', // sender
  16. to: 'receiver@hotmail.com', // list of receivers
  17. subject: 'Hello from sender', // Mail subject
  18. html: '<b>Do you receive this mail?</b>' // HTML body
  19. };
  20.  
  21. // send mail with defined transport object
  22. transporter.sendMail(mailOptions, function (err, info) {
  23. if(err)
  24. console.log(err)
  25. else
  26. console.log(info);
  27. });
Add Comment
Please, Sign In to add comment