Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. var nodemailer = require('nodemailer');
  2.  
  3. const subscribe = {
  4. send: function(name, service) {
  5. const transporter = nodemailer.createTransport({
  6. service: 'Gmail',
  7. auth: {
  8. user: 'your gmail username',
  9. pass: 'your gmail password'
  10. },
  11. }, {
  12. from: 'Sender Name <your-gmail-username@gmail.com>',
  13. });
  14.  
  15. const message = {
  16. to: '"Your name" <your-gmail-username@gmail.com>',
  17. subject: 'Some subject line',
  18. text: 'This is the body of your email. Use string concat to add variables in here',
  19. };
  20.  
  21. transporter.sendMail(message, function (error, info) {
  22. if (error) {
  23. console.log('Err', error.message);
  24. return;
  25. }
  26. console.log('Message sent successfully 🔥');
  27. });
  28. },
  29. }
  30.  
  31. module.exports = subscribe;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement