隨著 Google 于 2022 年 5 月 30 日關閉安全性較低的應用程式,現在將 Gmail 與 nodemailer 一起使用會引發錯誤訊息response: '535-5.7.8 Username and Password not accepted. Learn more at\n' '535 5.7.8 https://support.google.com/mail/?p=BadCredentials。Nodemailer檔案似乎尚未更新有關安全性較低的應用程式的問題,但建議使用其他交付提供商。我以前只是打開 LSA,將憑據存盤在環境變數中,然后讓 nodemailer 做它的事情,通過這個更改,如何仍然使用 gmail 和 nodemailer?目前還沒有 youtube 教程來解決這個問題,并且查看google 檔案,它沒有顯示 nodemailer
uj5u.com熱心網友回復:
通過在 Google 帳戶中創建應用程式密碼來解決它。您必須激活兩步驗證。


uj5u.com熱心網友回復:
您應該查看xoauth Nodemailer 似乎支持 serval oauth選項
let transporter = nodemailer.createTransport({
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
type: "OAuth2",
user: "[email protected]",
clientId: "000000000000-xxx0.apps.googleusercontent.com",
clientSecret: "XxxxxXXxX0xxxxxxxx0XXxX0",
refreshToken: "1/XXxXxsss-xxxXXXXXxXxx0XXXxxXXx0x00xxx",
accessToken: "ya29.Xx_XX0xxxxx-xX0X0XxXXxXxXXXxX0x",
expires: 1484314697598,
},
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/486452.html
