2014-04-10 13 views
0

我有一个情景,就像用户注册其身份时一样,我将不得不向他们发送激活链接进行验证。 我不想通过GMAIL/YAHOO/LIVE等发送邮件。我可以从我的办公室创建组邮件ID([email protected])。 我的问题是我不知道如何设置这个过程。我应该怎么做..我必须设置任何SMTP服务器?如果是的话,我的问题是如何创建smtp服务器?如何使用NodeJS和nodemailer从办公室组邮件ID向用户发送邮件

Could you please help to get away from this bottleneck ?? 

    smtpConfig = nodemailer.createTransport('SMTP', { 
service: 'OfficeMailBox', 
auth: { 
user: "[email protected]", 
pass: "yourpasswordgoeshere" 
} 
}); 

mailOpts = { 
from: req.body.name + ' <' + req.body.email + '>', 
to: '[email protected]', //replace it with id you want to send multiple must be separated by  , 
subject: 'contact form', 
text: req.body.message 
}; 

smtpConfig.sendMail(mailOpts, function (error, response) { 
//Email not sent 
if (error) { 
res.end("Email send Falied"); 
} 
//email send sucessfully 
else { 
res.end("Email send sucessfully"); 
} 
}); 

问候 拉姆

+0

你找到了一个解决方案? – Dev

回答

0

您可以设置自定义的SMTP服务器地址:

smtpConfig = nodemailer.createTransport('SMTP', { 
    host: 'smtp.yourserver.com',//<---- 
    auth: { 
    user: "[email protected]", 
    pass: "yourpasswordgoeshere" 
    } 
}); 
相关问题