aspose 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 Java 8 in Action this week in the Java 8 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: 1034
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: 1034
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: 8713
    
    6

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: 1034
Is "opening a socket" difficult?

Mike
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8713
    
    6

Mike London
Ranch Hand

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

Thanks very much!!!

Mike
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SMTP Server Alive Check?
 
Similar Threads
JavaMail
smtps and javamail
Was Authentication needed?
Call a Servlet from JSP
Java mail error