wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes Notify status of bounced email sent using Javamail API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Notify status of bounced email sent using Javamail API" Watch "Notify status of bounced email sent using Javamail API" New topic
Author

Notify status of bounced email sent using Javamail API

cle tan
Ranch Hand

Joined: Jun 11, 2012
Posts: 68
I already have a program to send the email using JavaAPI.
The catch is that if let's say if aaa@hotmail.com is an invalid email address, it still sends the mail out, and there's no way for my application to
detect that it is a invalid email address.
Assuming that the rebound email received in the email server in 5 sec, I would like to get some reply from the email server, saying that the email
was not sent successfully.

Is it possible?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

You might want to take a look at http://www.coderanch.com/t/453931/java/java/handle-wrong-mail-address-sending


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
cle tan
Ranch Hand

Joined: Jun 11, 2012
Posts: 68
but even when it sends successfully to the invalid email address, there is no exception produced.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

cle tan wrote:but even when it sends successfully to the invalid email address, there is no exception produced.

In the example you provided with your original post, "invalid" is invalid from your business perspective. From the javamail perspective, as long as it confirms to RFC 2822, it is a valid mail ID.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42267
    
  64
I couldn't put it better now than I put it back then :-)

The short version is: the code that sends the email can not do this check. You need to write separate code that checks the account used to send the mail for bounces.


Ping & DNS - my free Android networking tools app
 
 
subject: Notify status of bounced email sent using Javamail API