Guest User

Untitled

a guest
Dec 11th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. exports.sendToken = function(data){
  2.  
  3. var from = 'sender@existing.com',
  4.  
  5. to = data.user;
  6.  
  7. subject = 'Email Password Reset Process',
  8.  
  9. msg = '<a href="https://new-domain.com/token/'+data.token+'/'+data.user+'"';
  10.  
  11. sendmail(from,to,'','',subject,msg);
  12.  
  13. }
  14.  
  15. function sendmail(from,to,cc,bcc,subject,html,attachments){
  16. let transporter = nodemailer.createTransport({
  17. pool:true,
  18. host: '127.0.0.1',
  19. port: 25,
  20. secureConnection: false,
  21. tls: {
  22. rejectUnauthorized: false,
  23. },
  24. });
  25. let mailOptions = {
  26. from: from, // sender address
  27. to: to,
  28. cc: cc,
  29. //~ bcc: bcc, // list of receivers
  30. subject:subject, // Subject line
  31. //~ text: stripTags(text), // plain text body
  32. html: html, // html body
  33. attachments: attachments
  34. };
  35. transporter.verify(function(error, success) {
  36. if (error) {
  37. console.log('ERROR IN TRANSPORTER.VERIFY',error);
  38. } else {
  39. console.log('Server is ready to take our messages');
  40. }
  41. });
  42. }
Add Comment
Please, Sign In to add comment