• 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

JavaMail API : getting "SMTPAddressFailedException"

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I am getting "SMTPAddressFailedException" when trying to send mails to a mail id which has the format like this:

firstname.last@main-dom.subdomain.com

The exception was like this :

com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for firstname.last@main-dom.subdomain.com

But when use my code to send a mail to recipient like this: name@domain.com it works fine.

Can anyone please help me out of it?

Thanks
 
Ranch Hand
Posts: 164
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
First try this manually to send mail(firstname.last@main-dom.subdomain.com). Because it may be a problem with smtp not in your program.
 
Sheriff
Posts: 22041
113
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by vinoth thirunavukarasu:
Because it may be a problem with smtp not in your program.


It most definitely is. Your SMTP server does not allow you to send these emails. Because the domain of the user is not that of the mail server it is trying to relay, and that's not allowed.

Better ask your system admin to help you out on the SMTP server configuration.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to add below lines in your code ,then your code should work properly....
prob.put("mail.transport.protocol", "smtp");
prob.put("mail.smtp.host", mailSmtpHost);
prob.put("mail.smtp.socketFactory.port", 252);
prob.put("mail.smtp.starttls.enable","true");
prob.put("mail.smtp.auth", "true");
prob.put("mail.smtp.port", 252);
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic