具有MS Exchange的Spring JavaMailSender:sendFailedException:无效的地址

时间:2017-09-09 09:12:52

标签: spring spring-mvc smtp javamail

我正在尝试从Spring Web应用程序发送邮件但未成功。我正在尝试向外部电子邮件ID发送邮件(下面的配置与内部电子邮件ID完美配合),在Tomcat服务器上部署了Spring Web应用程序的Exchange通过端口25没有身份验证,没有SSL。

重要

abcd.com是内部域名 zxc.com是外部域名

错误 sendFailedException:无效地址

*登录

DEBUG SMPT:有效的未发送地址

DEBUG SMPT:tharaka@abcd.com

DEBUG SMPT:dinesh@abcd.com

DEBUG SMPT:地址无效

DEBUG SMPT:hoon@zxc.com

DEBUG SMPT:wong@zxc.com

DEBUG SMPT:发送失败,因为目的地址无效。*

我正在使用:

春天 - 4.2.6.RELEASE javax.mail-api - 1.5.5 邮件 - 1.4.7

@Bean

public JavaMailSender getMailSender() {

JavaMailSenderImpl mailSender = new JavaMailSenderImpl();

Properties javaMailProperties = new Properties();
javaMailProperties.put("mail.smtp.host", "smtp.abcd.com");
javaMailProperties.put("mail.smtp.port", "25");
javaMailProperties.put("mail.debug", "true");

mailSender.setJavaMailProperties(javaMailProperties);

return mailSender;

}

日志文件

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.abcd.com", port 25, isSSL false
220 W01G.test**s.com Microsoft ESMTP MAIL Service ready at Sat, 9 Sep 2017 20:55:18 +0800
DEBUG SMTP: connected to host "smtp.abcd.com", port: 25

EHLO x01gdcimapp1a
250-W01G.test**s.com Hello [10.56.198.28]
250-SIZE 10485760
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-AUTH
250-8BITMIME
250-BINARYMIME
250 CHUNKING
DEBUG SMTP: Found extension "SIZE", arg "10485760"
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "AUTH", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<imsdc@abcd.com>
250 2.1.0 Sender OK
RCPT TO:<cbowers@zxc.com>
550 5.7.1 Unable to relay
RCPT TO:<mpsantos@zxc.com>
550 5.7.1 Unable to relay
RCPT TO:<debbaes@zxc.com>
550 5.7.1 Unable to relay
RCPT TO:<chongkheng@zxc.com>
550 5.7.1 Unable to relay
RCPT TO:<cherhengc@zxc.com>
550 5.7.1 Unable to relay
RCPT TO:<tharakadinesh@abcd.com>
250 2.1.5 Recipient OK
RCPT TO:<pdcsecurity@abcd.com>
250 2.1.5 Recipient OK
RCPT TO:<siewfernfang@abcd.com>
250 2.1.5 Recipient OK
RCPT TO:<wenmengkohkoh@abcd.com>
250 2.1.5 Recipient OK
DEBUG SMTP: Valid Unsent Addresses
DEBUG SMTP:   tharakadinesh@abcd.com
DEBUG SMTP:   pdcsecurity@abcd.com
DEBUG SMTP:   siewfernfang@abcd.com
DEBUG SMTP:   wenmengkohkoh@abcd.com
DEBUG SMTP: Invalid Addresses
DEBUG SMTP:   cbowers@zxc.com
DEBUG SMTP:   mpsantos@zxc.com
DEBUG SMTP:   debbaes@zxc.com
DEBUG SMTP:   chongkheng@zxc.com
DEBUG SMTP:   cherhengc@zxc.com
DEBUG SMTP: Sending failed because of invalid destination addresses
RSET
250 2.0.0 Resetting
DEBUG SMTP: MessagingException while sending, THROW: 
javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

    at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1996)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1240)
    at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:448)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:362)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:350)
    at com.abcd.dcim.mail.MailServiceImpl.sendEmail(MailServiceImpl.java:105)
    at com.abcd.dcim.mail.DCIMSMailServiceImpl$3.run(DCIMSMailServiceImpl.java:62)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

    at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1849)
    ... 10 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

    ... 11 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

    ... 11 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

    ... 11 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

    ... 11 more
QUIT
221 2.0.0 Service closing transmission channel
Failed messages: javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

0 个答案:

没有答案