javamail不能发送邮件的问题
用javamail写的程序,本机测试可以发送邮件,放到服务器上面发不了,
本机telnet smtp.163.com 25,成功,
服务器telnet smtp.163.com 25,失败,
有人说是服务器的防火墙问题,有点不明白:
是不是只要telnet smtphost 25失败,就无法发送邮件?要是的话,该怎么办呢?
错误提示:
16:47:43,921 ERROR [STDERR]
javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: connect
16:47:43,921 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
16:47:43,921 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
16:47:43,921 ERROR [STDERR] at javax.mail.Service.connect(Service.java:297)
16:47:43,921 ERROR [STDERR] at javax.mail.Service.connect(Service.java:156)
16:47:43,921 ERROR [STDERR] at javax.mail.Service.connect(Service.java:105)
16:47:43,921 ERROR [STDERR] at javax.mail.Transport.send0(Transport.java:168)
16:47:43,921 ERROR [STDERR] at javax.mail.Transport.send(Transport.java:98)
16:47:43,921 ERROR [STDERR] at tff.util.SendMail.sendMessage(SendMail.java:63)
16:47:43,921 ERROR [STDERR] at zzl.bean.CompanyOP.SendMailAfterRegister(CompanyOP.java:643)
16:47:43,921 ERROR [STDERR] at zzl.servlet.CompanyNewServlet.doGet(CompanyNewServlet.java:146)
16:47:43,921 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
16:47:43,921 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
16:47:43,921 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
16:47:43,921 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
16:47:43,921 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
16:47:43,921 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
16:47:43,921 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
16:47:43,921 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
16:47:43,921 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
16:47:43,921 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
16:47:43,921 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
16:47:43,921 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
16:47:43,921 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
16:47:43,92