Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaMail API : getting "SMTPAddressFailedException"

 
GopiKrishnan gkrishna
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
 
Vinoth Thirunavukarasu
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.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java 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.
 
Marimuthu Udayakumar
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);
 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!