阿里邮箱发送失败
2017-08-04 11:21:57
2235
1
我用javamail发送带附件邮箱.接收和发送的邮箱都是阿里邮箱.我的配置如下
Properties props = new Properties(); // 参数配置
props.setProperty("mail.transport.protocol", "smtp"); // 使用的协议
props.setProperty("mail.smtp.host", "smtp.lianshangche.com"); // 发件人的邮箱的 SMTP 服务器地址
props.setProperty("mail.smtp.auth", "true"); // 需要请求认证
我在本地win10环境是没问题.但是把war包放到阿里云服务器上却报错了,错误如下
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.lianshangche.com, port: 25;nested exception is:java.net.ConnectException: Connection timed outorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)javax.servlet.http.HttpServlet.service(HttpServlet.java:624)org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)javax.servlet.http.HttpServlet.service(HttpServlet.java:731)org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
请大神帮忙解决一下.我一个收件人和多个收件人都试过了 一样报错
取消
提交回答
全部回答(1)
-
洵云
2017-08-05 08:06:29
smtp服务器地址对吗,换一个试试呢?