JAVAMAILSMTP错误

时间:2012-02-16 14:05:25

标签: javamail

我正在使用javamail发送电子邮件。我已将javamail和JAF库添加到我的项目中。但是当我从RAD 7.0中的websphere运行它时,我收到以下错误。

    2/16/12 19:16:15:445 IST] 00000026 SystemOut     O DEBUG SMTP: trying to connect to host "webmail.emailmyname.com", port 25, isSSL false
[2/16/12 19:16:17:437 IST] 00000026 SystemOut     O Exiting MailServlet
[2/16/12 19:16:17:430 IST] 00000026 SystemErr     R javax.mail.MessagingException: Could not connect to SMTP host: webmail.emailmyname.com, port: 25;
  nested exception is:
    java.net.ConnectException: Connection refused: connect
[2/16/12 19:16:17:430 IST] 00000026 SystemErr     R     at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
[2/16/12 19:16:17:430 IST] 00000026 SystemErr     R     at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
[2/16/12 19:16:17:430 IST] 00000026 SystemErr     R     at javax.mail.Service.connect(Service.java:275)
[2/16/12 19:16:17:430 IST] 00000026 SystemErr     R     at javax.mail.Service.connect(Service.java:156)
[2/16/12 19:16:17:430 IST] 00000026 SystemErr     R     at javax.mail.Service.connect(Service.java:105)
[2/16/12 19:16:17:430 IST] 00000026 SystemErr     R     at javax.mail.Transport.send0(Transport.java:168)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at javax.mail.Transport.send(Transport.java:98)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at com.devx.example.MailServlet.doPost(MailServlet.java:64)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1449)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
[2/16/12 19:16:17:431 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
[2/16/12 19:16:17:432 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
[2/16/12 19:16:17:432 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
[2/16/12 19:16:17:432 IST] 00000026 SystemErr     R     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
[2/16/12 19:16:17:432 IST] 00000026 SystemErr     R     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(H    

1 个答案:

答案 0 :(得分:0)

您的服务器已关闭或配置为在其他端口上运行。您可以发出“telnet webmail.emailmyname.com 25”,如果您收到回复“telnet:无法连接到远程主机:连接被拒绝”,则可能是您的服务器配置在不同的端口上(您还可以验证是否您的服务器因发出“ping webmail.emailmyname.com”而关闭。