Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SMTP Server Alive Check?

 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a (simple) way to tell from the JavaAPI, say before you actually try to send an email, if the SMTP server is alive (that is, will respond to requests)?

// pseudo code...
// if connection.isAlive()
// mail.send();

Thanks very much in advance!!!

Mike
 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my original posting above, I meant to ask if it's possible to see if the SMTP server is alive using the JavaMail API (not the JavaAPI).

Thanks again for any replies.

Mike
 
Joe Ess
Bartender
Posts: 9298
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could open a socket to port 25 on the SMTP host and see if that's successful. Maybe even engage in a little SMTP protocol exchange and make sure it is an SMTP server that's listening.
 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is "opening a socket" difficult?

Mike
 
Joe Ess
Bartender
Posts: 9298
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's too hard! <g>

Thanks very much!!!

Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic