Welcome_Word
Welcome_Word
采纳率100%
2017-02-20 06:31 浏览 4.1k
已采纳

javamial 邮件发送报554

5

com.sun.mail.smtp.SMTPSendFailedException: 554 DT:SPM 163 smtp9,DcCowAC3PsuoiqpYR4q8Ig--.10814S2 1487571625,please see http://mail.163.com/help/help_spam_16.htm?ip=125.90.50.8&hostid=smtp9&time=1487571625

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1668)
at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1473)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:738)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:120)
at cn.dmandp.web.servlet.EmailVerifyServlet.doPost(EmailVerifyServlet.java:143)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at cn.dmandp.filter.EncodingFilter.doFilter(EncodingFilter.java:48)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

代码应该是没有错的,因为它经常可以发出去,就是偶尔会报554,但是还是把代码贴出来,求大神帮忙看看,怎么解决,现在就是我常用邮箱大部分可以成功发送,偶尔出现554,新申请本来打算用作专用邮箱的结果是一封邮件也发不出去,一直554,同样的邮件内容;代码如下:

//发email-----------start
    Properties props=new Properties();
    Properties mymailprops=new Properties();
    InputStream pis=this.getClass().getClassLoader().getResourceAsStream("Jmail.properties");
    InputStream mymailpis=this.getClass().getClassLoader().getResourceAsStream("mymail.properties");
    props.load(pis);
    mymailprops.load(mymailpis);
    Authenticator authenticator=new Authenticator() {
        @Override
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(mymailprops.getProperty("accountname"),mymailprops.getProperty("password"));
        }
    };
    Session session=Session.getInstance(props,authenticator);
    MimeMessage msg=new MimeMessage(session);
    try {
        msg.setFrom(new InternetAddress(mymailprops.getProperty("fromAddress")));
    msg.setRecipients(RecipientType.TO, form.getEmail());
    msg.setRecipients(RecipientType.CC,mymailprops.getProperty("fromAddress"));
    msg.setSubject("dmandp");
    msg.setContent("欢迎加入dmandp,你的验证码为["+codes+"],请尽快完成验证.若非本人操作,请忽略此邮件.","text/html;charset=utf-8");
    Transport.send(msg);
    //发email-------------end

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答 默认 最新

  • 已采纳
    Welcome_Word Welcome_Word 2017-02-20 06:35

    百度跟网易的解释是邮件有垃圾内容,但是如果这样没道理大部分情况下可以,偶尔出错,而且,有的邮箱可以有的邮箱不可以

    点赞 评论 复制链接分享
  • ljheee ljheee 2017-02-20 07:46

    可能原因:

    1、发送大量的广告信/推广信。(广告邮件)

    2、发送了用户事先并未提出要求或者同意接收的邮件。(垃圾邮件)
    3、发送的邮件包含大量不存在的收件人

    解决办法

    去掉条件直接读取全部邮件,

    message message[] = folder.getMessages();
    不加条件即可解决去查询邮件,即可解决

    点赞 评论 复制链接分享
  • baipiang baipiang 2017-02-20 12:28

    建议把debug模式打开,看看客户端和服务器间握手的信息,这样可以看出具体的问题

    点赞 评论 复制链接分享

相关推荐