开发者社区> 问答> 正文

阿里邮箱发送失败

我用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)
请大神帮忙解决一下.我一个收件人和多个收件人都试过了 一样报错

展开
收起
长沙大猫 2017-08-04 11:21:57 2516 0
1 条回答
写回答
取消 提交回答
  • smtp服务器地址对吗,换一个试试呢?
    2017-08-05 08:06:29
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
阿里邮箱—安全高效集成 立即下载
阿里邮箱安全高校集成 立即下载
低代码开发师(初级)实战教程 立即下载