无法连接到SMTP主机:{remote-server},端口:{port},响应:-1 [英] Could not connect to SMTP host: {remote-server}, port: {port}, response: -1

查看:127
本文介绍了无法连接到SMTP主机:{remote-server},端口:{port},响应:-1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Java Mail API发送邮件。但是上面的
消息给我带来了例外。

I am trying to send mail using java mail api. But exception is come to me with above message.


无法连接到SMTP主机:{remote-server},端口:{port},响应:-1

Could not connect to SMTP host: {remote-server}, port: {port}, response: -1

响应:-1

我在api手册中找不到此代码。

I can`t found this code in api manual.

推荐答案

响应代码 -1 表示JavaMail无法从SMTP服务器获得有效的响应代码。您可以查看相关的源此处

A response code of -1 means that JavaMail failed to get a valid response code from the SMTP server. You can view the relevant source here.

最有可能的是,您的属性设置不正确或存在网络问题,例如防火墙阻止了连接。

Most likely, you either have your properties set incorrectly or you have a networking issue such as a firewall blocking the connection.

您可以尝试启用调试模式( session.setDebug(true))。如果您需要进一步的帮助,请发布您的代码。

You might try enabling debug mode (session.setDebug(true)). Please post your code if you need further help.

这篇关于无法连接到SMTP主机:{remote-server},端口:{port},响应:-1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆