Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot detect invalid address in Java Mail

 
Arsalan Madjd
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You send mail and if it comes back rejected then the address doesn't exist.
What are you trying to accomplish?
 
Arsalan Madjd
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic