EmailException:将电子邮件发送到以下服务器失败:smtp.gmail.com:465 [英] EmailException: Sending the email to the following server failed : smtp.gmail.com:465
问题描述
我编写了一个程序,使用scala Play 2.3.8从我的gmail帐户发送邮件 然后我得到以下异常:
I wrote a program to send mail from my gmail account using scala Play 2.3.8 then i got the following exception:
[EmailException:将电子邮件发送到以下服务器失败: smtp.gmail.com:465],位于MailerPlugin.send(email)
[EmailException: Sending the email to the following server failed : smtp.gmail.com:465] at MailerPlugin.send(email)
我的代码如下:
val email = Email(
"A personal mail",
"LeeSa <xxxxxx@gmail.com>",
Seq("Recepient <yyyyyy@gmail.com>"),
// adds attachment
attachments = Seq(
),
bodyHtml = Some("""
<html>
<body>
<h3>Hai ,</h3>
<p> This is a test message. </p>
</body>
</html>
""")
)
MailerPlugin.send(email)
application.conf包含配置
application.conf contains the configuration
smtp.host=smtp.gmail.com
smtp.port=465
smtp.ssl=yes
smtp.tls=yes
smtp.user="xxxxxxx@gmail.com"
smtp.password="MyPassword"
有人可以帮助我吗?
推荐答案
这种异常通常是由于服务提供商通过现代安全标准保护您的帐户而引起的.
This kind of exception commonly occurs because the service provider protects your account by modern security standards.
您必须禁用此选项才能以正确的方式执行您的应用程序.
您可以通过访问链接来做到这一点
https://www.google.com/settings/security/lesssecureapps
登录到您的Gmail帐户后,然后打开安全性较低的应用程序的访问权限.
You have to disable this for executing your application in the right way.
You can do this by visiting the link
https://www.google.com/settings/security/lesssecureapps
after log in into your Gmail account, and turn on the access for the less secure app.
我希望这能使您摆脱困境. :-)
I hope this will bring you out of the issue. :-)
这篇关于EmailException:将电子邮件发送到以下服务器失败:smtp.gmail.com:465的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!