0

我正在开发一些有时应该发送邮件的应用程序。不幸的是管理员说我不能通过传统的 smtp 协议发送邮件,因为他阻止了它。

他告诉我有两种方法可以做到:1)“在这种情况下将中继服务器设置为应用程序 somestringrnotesmtp.domain.com”

在这种情况下,它看起来像是 Lotus rnotes 提供的某个 smtp 服务器。但是当我尝试使用 org.apache.commons.mail 发送邮件时,我遇到了异常

Caused by: javax.mail.MessagingException: Could not connect to SMTP host: somestringrnotesmtp.domain.com, port: 465;
  nested exception is:
    java.net.ConnectException: Connection refused
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
    at javax.mail.Service.connect(Service.java:295)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:125)
    at javax.mail.Transport.send0(Transport.java:194)
    at javax.mail.Transport.send(Transport.java:124)
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1388)
    ... 40 more
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:317)
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:207)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1938)
    ... 47 more
  1. “为此目的使用 unix sendmail”我不知道如何做到这一点。有没有这样做的java库?
4

0 回答 0