本文介绍了无法连接到SMTP端口465的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法连接到使用SSL身份验证的smtp端口465.以前它曾经在默认端口25上工作,但已将所有外发电子邮件的出站电子邮件的设置更改为指向465.当我使用Outlook时,它工作得很好,但显示它无法连接到端口465.

I am not able to connect to smtp port no 465, which uses SSL authentication. Earlier it used to work in default port 25, but have changed the setting to point to 465 for outbound emails for all outgoing emails. This works perfectly fine when i use outlook but shows that it cannot connect to port 465.

下面是错误.

javax.mail.SendFailedException: Sending failed;
  nested exception is:
        javax.mail.MessagingException: Could not connect to SMTP host: smtp.bizmail.yahoo.com, port: 465
        at javax.mail.Transport.send0(Transport.java:218)
        at javax.mail.Transport.send(Transport.java:80)

下面是我使用的Javax Mail设置.

And below is the Javax Mail setting that i use.

 Properties props = System.getProperties();
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.socketFactory.class",
    props.setProperty("mail.smtp.port", "465");
    props.put("mail.smtp.ssl.enable", "true");
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.server.username", "[email protected]");
    props.put("mail.server.password", "test123");
    props.put("mail.smtp.auth", "true");
    props.setProperty("mail.smtp.submitter",   authenticator.getPasswordAuthentication().getUserName());
    Session session = Session.getInstance(props, authenticator);
    session.setDebug(sessionDebug);

任何帮助将不胜感激.

推荐答案

如日志所示,端口465上的 smtp.bizmail.yahoo.com 无法连接,如果您使用的是gmail,主机应为: smtp.gmail.com .

As the log says, smtp.bizmail.yahoo.com at port 465 cannot be connected, if you are using gmail, the host should be:smtp.gmail.com.

供参考:

Gmail-主机:smtp.gmail.com,端口:465

Gmail- Host: smtp.gmail.com , Port: 465

Hotmail-主机:smtp.live.com,端口:587

Hotmail- Host: smtp.live.com , Port: 587

Yahoo-主机:smtp.mail.yahoo.com,端口:465

Yahoo- Host: smtp.mail.yahoo.com , Port: 465

这篇关于无法连接到SMTP端口465的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 00:50