email - Nodemailer:在 prod 中发送电子邮件不起作用,但在本地工作中发送它们
问题描述
我正在使用 gmail 和 nodemailer 在我的 nodejs 应用程序中发送电子邮件。
我正在使用这个选项:
启用使用该 gmail 帐户发送密码。
奇怪的是,这在本地工作得很好,但在 prod 中它不起作用,我得到这个错误:
~ 文件:emailServices.js ~ 第 68 行 ~ 错误错误:无效登录:534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbv
534-5.7.14 C_k04HIybV5ampaq-t350mMioC50ryqetyrL6tihifwJHVt_1-5ahsYJ8JYb0IT34QSqZ
534-5.7.14 DkukvbTnIdTmckxb3ykL5Vf1pVL2L5NwGcL_fe1yRKIiikKWbmwLQT2AEWEkjALw>
534-5.7.14 请通过网络浏览器登录,然后重试。
534-5.7.14 了解更多信息
534 5.7.14 https://support.google.com/mail/answer/78754 cf11sm38885edb.65 - gsmtp
这是它的配置方式:
var transport = nodemailer.createTransport({
service: "gmail",
auth: {
user: process.env.SUPPORT_EMAIL,
pass: process.env.SUPPORT_EMAIL_PASSWORD,
},
});
onst sendEmailAsync = async function sendEmailAsync(
destination_email,
subject,
html_email_content
) {
const mailOptions = {
// I think here it is why the email received is lodeepstartup
from: "email@gmail.com",
to: destination_email,
subject: subject,
html: html_email_content,
};
return new Promise((resolve, reject) => {
transport.sendMail(mailOptions, function (error, info) {
if (error) {
reject(false);
} else {
resolve(true);
}
});
});
};
注意:
在 prod 中部署应用程序后,我收到来自谷歌的警报,说有人登录,但我点击按钮验证是我。
那么,也许谷歌一直将我的 VPS 列入黑名单,使其无法使用该电子邮件登录?
解决方案
推荐阅读
- c++ - QT Subdir - 未定义的参考
- shell - 使用 shell 重置变量
- list - prolog 谓词返回事实(?)
- charts - Google Datastudio 多个重新分区和类型图表
- magento2 - Magento2.0 服务器要求 - 需要指导
- amp-html - AMP 中的 Brightcove 视频对接
- apache-storm - [Storm]如果其中一个失败,锚定到相同消息 id 的其他元组会发生什么?
- java - BridJ:加载 Clp.dll 时发生 LoadLibrary 错误:动态链接库 (DLL) 初始化例程失败
- oracle - varchar 立即执行
- json - 在没有反斜杠的请求中发送 JSON