• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

send mail in java "relay" problem

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi experts , i am trying to send mail from my exchange server to outside but I could not and i am getting this error

DEBUG SMTP: Found extension "XSHADOW", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<ali.alsoumahi@dy.ae>
250 2.1.0 Sender OK
RCPT TO:<alooosh@hotmail.my>
550 5.7.1 Unable to relay
DEBUG SMTP: Invalid Addresses
DEBUG SMTP: alooosh@hotmail.my
DEBUG SMTP: Sending failed because of invalid destination addresses
RSET
250 2.0.0 Resetting
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1446)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:736)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:120)
at SendEmailUsingGMailSMTP.main(SendEmailUsingGMailSMTP.java:58)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1297)


I have the java mail program and I am using it to send mails internally , but I got this " relay error " although I can send to outside mail using my outlook

yes if I tried to send from the outlook to outside mail whatever it is , it sends the message successfully and I can get the message , which means the exange server relay is enabled for internall domain
but why from the program it is gving this error . My program is from internal domain

thanks a lot
 
Ranch Hand
Posts: 86
2
VI Editor Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've got the exception because the SMTP communication failed. Your Exchange server says it can't relay e-mail to the address "alooosh@hotmail.my". Using dig or nslookup utility will show you that there's no MX record for that domain, so that's why. You've probably just misspelled the e-mail address.
 
alsoumahi alBatal
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tomas Linhart wrote:You've got the exception because the SMTP communication failed. Your Exchange server says it can't relay e-mail to the address "alooosh@hotmail.my". Using dig or nslookup utility will show you that there's no MX record for that domain, so that's why. You've probably just misspelled the e-mail address.



sorry for late reply and happy new year for you . I did not misspelled the e-mail address at all , I changed it to another and run the program again still showing the same error

Sending failed because of invalid destination addresses
RSET
250 2.0.0 Resetting
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1446)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:736)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:120)
at SendEmailUsingGMailSMTP.main(SendEmailUsingGMailSMTP.java:62)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1297)
... 4 more
QUIT
221 2.0.0 Service closing transmission channel
Exception in thread "main" java.lang.RuntimeException: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

at SendEmailUsingGMailSMTP.main(SendEmailUsingGMailSMTP.java:69)
Caused by: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1446)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:736)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:120)
at SendEmailUsingGMailSMTP.main(SendEmailUsingGMailSMTP.java:62)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1297)
... 4 more


this is my program code :




please help me , is it with the exchange server or my program
 
Marshal
Posts: 26128
77
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Unable to relay" means that the Exchange server is on machine X, and you are trying to connect to it from machine Y and send an e-mail outside of its domain. Generally SMTP servers don't like serving requests from outside machines ("relaying") like that, because that's a standard way for spammers to send their spam. However it is possible to configure the server to allow relaying from machine Y -- talk to the administrator of the server to get that done.
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic