wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes Cannot detect invalid address in Java Mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Cannot detect invalid address in Java Mail" Watch "Cannot detect invalid address in Java Mail" New topic
Author

Cannot detect invalid address in Java Mail

Arsalan Madjd
Greenhorn

Joined: Feb 21, 2001
Posts: 10
Hello,
I have tried the example msgsendsample.java (and other similar examples) that comes with JavaMail . If the recipient address does not exist, Transport.send would not throw an exception. How I can detect an invalid (i.e. non existing address)?
Many thanks,
Arsalan Madjd
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You send mail and if it comes back rejected then the address doesn't exist.
What are you trying to accomplish?


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Arsalan Madjd
Greenhorn

Joined: Feb 21, 2001
Posts: 10
I am trying to send email within a Java application and would like to detect if the address I am sending to is invalid. Currently if the address in invalid, the "send" call goes through without any exception and the program terminates. Should I be waiting for the rejected email?
Thanks,
Arsalan
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Arsalan Madjd:
Should I be waiting for the rejected email?
You could wait but it might not be back for a few days. The question is, why do you want to know if it is invalid? Is it critical to your application?
Arsalan Madjd
Greenhorn

Joined: Feb 21, 2001
Posts: 10
yes. It is a part of our requirements to detect the bounced emails. In my test program when send email to an invalid email address, I get an email notification from our mailer daemon within few minutes.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Arsalan Madjd:
yes. It is a part of our requirements to detect the bounced emails. In my test program when send email to an invalid email address, I get an email notification from our mailer daemon within few minutes.
Not every bounced e-mail will return that quickly. Some may take awhile because the e-mail address you are sending to is temporarily down.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Arsalan Madjd:
yes. It is a part of our requirements to detect the bounced emails.
The question is why is that a requirement? Would it be feasible for example to send a test e-mail that the user must repsond to? Then you could send a url pointing to a servlet which would then verify that the user received the e-mail.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot detect invalid address in Java Mail
 
Similar Threads
Invalid Cookie
how to know that a particular ip is being accessed.
Google Map Mashup problem
javax.mail.MessagingException: 501 5.1.7 Invalid address
Check for invalid file name