public static boolean verify ( String host , String username , String password , int port ) throws SMTPException { try { return _verify ( host , username , password , port ) ; } catch ( MessagingException e ) { // check user if ( ! StringUtil . isEmpty ( username ) ) { try { _verify ( host , null , null , port ) ; throw new SMTPExceptionImpl ( "can't connect to mail server, authentication settings are invalid" ) ; } catch ( MessagingException e1 ) { } } // check port if ( port > 0 && port != 25 ) { try { _verify ( host , null , null , 25 ) ; throw new SMTPExceptionImpl ( "can't connect to mail server, port definition is invalid" ) ; } catch ( MessagingException e1 ) { } } throw new SMTPExceptionImpl ( "can't connect to mail server" ) ; } }
verify mail server