i use node mailer, send mail link click link confirm account. send mail gmail account, ok. when send yahoo mail, click link nothing happen. this code:
var nodemailer = require("nodemailer"); var smtptransport = nodemailer.createtransport("smtp",{ service: "gmail", auth: { user: "xxx@gmail.com", pass: "aaaa" } }); exports.signupconfirm = function(user){ var mailoptions = { from: "admin <admin@stockexchange.cu8>", // sender address to: user.username, // list of receivers subject: "xác nhận đăng ký tại stockexchange", html: "<b>xin chào "+user.lastname+" "+user.firstname+"!</b>" +"<br/>hãy click vào link dưới đây để hoàn thành đăng ký tại stockexchange:" +"<br/><a href='localhost/signupconfirmed/"+user.username+"'>hoàn thành đăng ký tại stockexchange!</a>" +"<br/>cảm ơn bạn đã đăng ký tại stockexchange!" } smtptransport.sendmail(mailoptions, function(error, response){ if(error){ console.log(error); }else{ console.log("message sent: " + response.message); } //smtptransport.close(); // shut down connection pool, no more messages }); }
anyone can me. thanks.
i couldn't open links in yahoo or thunderbird when sent nodemailer, when built link in variable textlink , called tostring() on variable, works:
var textlink = "http://" + req.headers.host + "/signup?token=" + data.hashedemail; var mailoptions = { from: auth_email, // sender address to: data.email, // list of receivers subject: "signup confirmation ✔", // subject line generatetextfromhtml: true, html: '<b>signup confirmation ✔</b><br />' + 'your email account : ' + data.email + '<br />' + '<a href=\"'+ textlink.tostring() + '\">click here activate account.</a>' + '<br />' + '<br /> text link: ' + textlink
i have included plain text version of url @ bottom of email in case user can't open hyperlink.
Comments
Post a Comment