我有一个场景,比如当用户注册他们的身份时,我必须发送他们激活链接进行验证。 我不想通过GMAIL / YAHOO / LIVE等发送邮件。我可以从我的办公室创建一个组mailID(xxx-support@yyy.com)。 我的问题是我不知道如何设置这个过程。我该怎么办..我必须设置任何SMTP服务器???如果是的话,我的问题是如何创建smtp服务器?
Could you please help to get away from this bottleneck ??
smtpConfig = nodemailer.createTransport('SMTP', {
service: 'OfficeMailBox',
auth: {
user: "xxx-support@yyy.com",
pass: "yourpasswordgoeshere"
}
});
mailOpts = {
from: req.body.name + ' <' + req.body.email + '>',
to: 'me@gmail.com', //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 :(得分:0)
您可以设置自定义smtp服务器地址:
smtpConfig = nodemailer.createTransport('SMTP', {
host: 'smtp.yourserver.com',//<----
auth: {
user: "xxx-support@yyy.com",
pass: "yourpasswordgoeshere"
}
});