I'm trying to send mail from Spring web application and unsuccessfully.I'm trying to send mail to external email ids(below configurations are working perfectly with internal email ids), with Exchange from Spring web application deployed on Tomcat server through port 25 with no authentication, no SSL.
important
abcd.com is internal domain zxc.com is external domain
Error sendFailedException: Invalid Addresses
*Log
DEBUG SMPT : Valid Unsent Addresses
DEBUG SMPT : tharaka@abcd.com
DEBUG SMPT : dinesh@abcd.com
DEBUG SMPT : Invalid Addresses
DEBUG SMPT : hoon@zxc.com
DEBUG SMPT : wong@zxc.com
DEBUG SMPT : Sending failed becaouse of invalid destination addresses.*
I'm using:
Spring - 4.2.6.RELEASE javax.mail-api - 1.5.5 mail - 1.4.7
code
@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;
}
log file
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