简体   繁体   English

使用 smtpJs 发送电子邮件时出错 (JavaScript)

[英]Error when using smtpJs to send email (JavaScript)

I'm having an error when I try to send an email with smtpJS:当我尝试使用 smtpJS 发送电子邮件时出现错误:

"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at (dont appear any link)." “SMTP 服务器需要安全连接或客户端未通过身份验证。服务器响应为:5.7.0 需要身份验证。了解更多信息(不要出现任何链接)。”

I had a notification of security on my email, but nothing was send, i've already enable the "less security apps" on my gmail, but nothing happen again, so, i dont know how to do it.我的电子邮件上有安全通知,但没有发送任何内容,我已经在我的 gmail 上启用了“安全性较低的应用程序”,但没有再发生,所以,我不知道该怎么做。

PS: I've already try to use nodemailer, but nope T_T PS:我已经尝试使用 nodemailer,但是没有 T_T

Email.send({
  Host: "smtp.gmail.com",
  Username: "<email>",
  Password: "<password>",
  To: "example@gmail.com",
  From: "example@gmail.com",
  Subject: "Test email",
  Body:
    "<html><h2>Header</h2><strong>Bold text</strong><br></br><em>Italic</em></html>",
}).then((message) => alert(message));

Have you tried to use app password: https://support.google.com/accounts/answer/185833?hl=en您是否尝试过使用应用密码: https : //support.google.com/accounts/answer/185833?hl=en

I myself got it working with app password, might be googles multilevel authentication.我自己使用应用程序密码使用它,可能是谷歌的多级身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM