554交易失败:重复标头'Reply-To'

时间:2018-10-18 11:54:11

标签: email smtp amazon-ses

我刚刚从Gmail SMTP切换到Amazon SES SMTP,以发送事务性邮件。切换后,出现以下错误,但我没有使用Gmail:

java.lang.IllegalStateException: Can't overwrite cause with com.sun.mail.smtp.SMTPSendFailedException: 554 Transaction failed: Duplicate header 'Reply-To'.

    at java.lang.Throwable.initCause(Throwable.java:456)
    at javax.mail.MessagingException.setNextException(MessagingException.java:51)
    at javax.mail.Transport.send(Transport.java:109)
    at javax.mail.Transport.send(Transport.java:48)


    at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 554 Transaction failed: Duplicate header 'Reply-To'.

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2108)
    at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1889)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1120)
    at javax.mail.Transport.send(Transport.java:95)
    ... 5 more

这是我在试图找出问题时的观察结果:

(1)如果我在“ Reply-TO”标头中指定了一个电子邮件地址,则不会发生此错误。

(2)如果我在“ Reply-TO”标头中指定了多个电子邮件地址,则会发生此错误。

想法将不胜感激。谢谢

1 个答案:

答案 0 :(得分:0)

这对我有用:

我从

更改了代码
Functor

收件人

   MimeMessage message = new MimeMessage(session);

   message.setReplyTo(new InternetAddress[1]);

这使我在replyTo标头中具有多个地址。