Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.sendToken = function(data){
- var from = 'sender@existing.com',
- to = data.user;
- subject = 'Email Password Reset Process',
- msg = '<a href="https://new-domain.com/token/'+data.token+'/'+data.user+'"';
- sendmail(from,to,'','',subject,msg);
- }
- function sendmail(from,to,cc,bcc,subject,html,attachments){
- let transporter = nodemailer.createTransport({
- pool:true,
- host: '127.0.0.1',
- port: 25,
- secureConnection: false,
- tls: {
- rejectUnauthorized: false,
- },
- });
- let mailOptions = {
- from: from, // sender address
- to: to,
- cc: cc,
- //~ bcc: bcc, // list of receivers
- subject:subject, // Subject line
- //~ text: stripTags(text), // plain text body
- html: html, // html body
- attachments: attachments
- };
- transporter.verify(function(error, success) {
- if (error) {
- console.log('ERROR IN TRANSPORTER.VERIFY',error);
- } else {
- console.log('Server is ready to take our messages');
- }
- });
- }
Add Comment
Please, Sign In to add comment