[英]com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1
I had implemented the ability to send email to Java. 我已经实现了将电子邮件发送到Java的功能。 However, from the moment I get the following error:
但是,从那一刻起,我得到以下错误:
DEBUG SMTP: need username and password for authentication
DEBUG SMTP: protocolConnect returning false, host=smtp.gmail.com, user=USERNAME, password=<null>
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 587, isSSL true
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1;
nested exception is:
java.net.ConnectException: Connection refused: connect
I think my code is not wrong. 我认为我的代码没有错。 Because my code works well on my two colleagues' PC.
因为我的代码在我的两个同事的PC上运行良好。 (telnet smtp.gmail.com 587) command works well.
(telnet smtp.gmail.com 587)命令效果很好。
Help me please. 请帮帮我。 I could not do anything for a few days because of this.
因此,我几天都不能做任何事情。
I am a beginner and I would appreciate it if you could let me know. 我是一个初学者,如果您能告诉我,我将不胜感激。
According to this : 根据这个 :
"Because my code works well on my two colleagues' PC. (telnet smtp.gmail.com 587) command works well"
“因为我的代码在我的两个同事的PC上运行良好。(telnet smtp.gmail.com 587)命令运行良好”
i assume that you already authorize access through less secure app in the gmail account you're using, and the problem is related to your own computer. 我假设您已经通过使用的gmail帐户中的安全性较低的应用授权访问,而问题与您自己的计算机有关。
Did you check your firewall or antivirus rules ? 您是否检查了防火墙或防病毒规则?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.