Home » Java/J2ee & open source

javax.mail.SendFailedException for invalid email addresses

6 November 2009 by Keshav Shetty 4,845 views One Comment

In java and j2ee we often send emails from our applications, Many times we get SendFailedException because few of the recipient email address are invalid which causes email delivery failure for even the valid recipient email address.

In order to bypass this exception and deliver the emails for valid email addresses, we can add following settings or enable properties so that whole email not rejected.

props.setProperty(“mail.smtp.sendpartial”, “true”);

or

props.put(“mail.smtp.sendpartial”,true);

In case if you still get this issue, then you need to check your server settings.

Also you can catch SendFailedException and find out valid unsent address using ex.getValidUnsentAddresses()


1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

One Comment »

  • Mudassar said:

    good post, thanks

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.