문제

we are using Apache james server with grails 2.1.1 to send and receive emails on our application.

Now we want to display an on/off icon on the page which can determine whether the James Mail Server is running or not.

So, is there a way in Java or grails to determine this.

도움이 되었습니까?

해결책

You could try connecting to the remote admin port (which I believe is port 4555 by default):

boolean jamesIsRunning = new Socket().with {
    try { 
        connect( new InetSocketAddress( 'localhost', 4555 ), 100 )
        close()
        true
    }
    catch( e ) {
        false
    }
}

Or if the remote admin port isn't open on your installation, you could try the SMTP port

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top