Gmail发送问题
,
所以我尝试自动发送gmail,但是由于错误,在检查后,它因错误而失败,用户名和通行证是真实的。因此,我想问一下是否有任何错误可能导致此错误。
这是我的代码,端口是465,我不希望有人知道我的通行证和我的用户名。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
,
所以我尝试自动发送gmail,但是由于错误,在检查后,它因错误而失败,用户名和通行证是真实的。因此,我想问一下是否有任何错误可能导致此错误。
这是我的代码,端口是465,我不希望有人知道我的通行证和我的用户名。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
错误消息<代码>“未接受的用户名和密码” 是发送用户实际的Google密码时从SMTP服务器中获取的标准错误消息。
SMTP服务器(2022年5月30日)无法接受这种身份验证方法。部分原因是删除 secure Secure Apps&amp&amp;您的Google帐户主要是因为客户登录不被认为是安全的。
您的选项是在我们的Google帐户上启用2FA并使用并创建 。只需在代码中使用它代替密码即可。
或使用 xoauth2 并对应用程序进行了认证。
The error message
"username and password not accepted"
is the standard error message you get from the smtp server when sending the users actual google password.This method of authentication is not acceptable by the SMTP server after (May 30, 2022). Partially due to the removal of Less secure apps & your Google Account mostly because client login is not considered to be secure.
Your options are to to enable 2fa on our google account and use and create an apps password. Simply use it in place of the password in your code.
Or to use XOauth2 and authenticate the application.
创建一个sendemail()函数,该功能将通过调用该功能来帮助将电子邮件发送给一个或多个收件人。
创建应用程序密码: /a>
Create a sendEmail() function, which will help to send emails to one or more than one recipient by calling the function.
Create App Password: App Passwords