开发商朋友
我很难理解为什么Gmail拒绝让我从我的服务器使用Nodemailer发送邮件。
这些都是我放入的设置。
const config1 = {
mailserver: {
service: "gmail",
auth: {
user: '[email protected]',
pass: 'got my password written out here'
}
},
mail: {
from: process.env.EMAIL_FROM,
to: req.body.email,
subject: `Account verification link`,
html: `
<h1>Please use the following link to reset your password:</h1>
<p>http://bhtraders-md.herokuapp.com/user/reset-password/${token}</p>
<hr/>
<p> This is an automatically generated email, please do not reply!</p>
`
}
};
let transporter = nodemailer.createTransport(config1.mailserver);
问题是每当我重新部署我的服务器,我禁用邮件上的验证码,我可以发送邮件,但大约5分钟,然后我得到一个错误,说我未经授权。我尝试了我在网上找到的所有可能的解决方案,但似乎无法持续工作。
只是为了记录,是的,我已经启用了不太安全的应用程序来访问电子邮件,但这似乎并不像一贯的工作。
我正在使用MERN堆栈,如果你们有什么其他建议,如何持续发送邮件进行邮件验证等,我很想得到一些建议。
先谢谢你