File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes SMTP Server Alive Check? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "SMTP Server Alive Check?" Watch "SMTP Server Alive Check?" New topic
Author

SMTP Server Alive Check?

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
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

Joined: Jul 12, 2002
Posts: 1043
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

Joined: Oct 29, 2001
Posts: 8834
    
    7

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Is "opening a socket" difficult?

Mike
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8834
    
    7

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
That's too hard! <g>

Thanks very much!!!

Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SMTP Server Alive Check?
 
Similar Threads
Java mail error
Was Authentication needed?
Call a Servlet from JSP
smtps and javamail
JavaMail