Advertisement
Guest User

Untitled

a guest
Oct 29th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. const nodemailer = require('nodemailer');
  2.  
  3. function sendMail() {
  4. const transporter = nodemailer.createTransport({
  5. service: 'Gmail',
  6. auth: {
  7. user: 'ggdb.info@gmail.com',
  8. pass: '<password>'
  9. }
  10. });
  11.  
  12. const mailOptions = {
  13. from: 'ggdb.info@gmail.com',
  14. to: email,
  15. subject: 'test email',
  16. text: 'test test'
  17. };
  18.  
  19. transporter.sendMail(mailOptions, function(error, info) {
  20. if (error) {
  21. console.log("Error while sending email.", error);
  22. }
  23. if (info) {
  24. console.log("info from sendMail: ", info);
  25. }
  26. console.log('email sent.');
  27. });
  28. }
  29.  
  30. sendMail();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement