1

尝试使用 MS ews java API 发送邮件时。尽管身份验证是完美的,但接收 PKIX 路径失败异常。请找到以下错误消息。我能够从我必须获取邮件内容的服务器连接到它,并且它工作到两天前。这是因为服务器机器的 JRE 有任何变化吗?我无法访问。

Oracle JDBC 驱动程序已注册!连接成功!连接关闭。线程“main” microsoft 中的异常。交换 。网页服务 。data.ServiceRequestException:请求失败。太阳 。security.vaIidator.VaIidatorException:PKIX 路径构建失败:sun。安全。provider.certpath.SunCertPathBuiIderException:无法在 microsoft.exchange.webservices 上找到请求目标的有效证书路径。data.ServiceRequestBase .getEwsHttpWebResponse(未知来源)

4

1 回答 1

0

使用下面的代码。

final Email email = new Email();

String host = hostname;
Integer port = portNumber;
String from = emailFrom;
String pass = emailFromPassword;
String[] to = emailTo;

String msgBody = "Hello";
email.setFromAddress("", from);
email.setSubject("Demo");
for (int i = 0; i < to.length; i++) {
  email.addRecipient("", to[i], RecipientType.TO);
}
}
email.setTextHTML(msgBody);

new Mailer(host, port, from, pass).sendMail(email);
于 2019-04-05T08:46:50.487 回答