N
Nishi Bhonsle
Hi:
I am calling the following code to validate whether the hostname entered on a page in a J2EE application is a valid SMTP server
Session _session = null;
Properties props = System.getProperties();
props.put("mail.smtp.host", hostname); //hostname passed from the page to the backend code
_session = Session.getDefaultInstance(props,null);
if ( session = = null )
{
//invalid hostname provided for a SMTP server
}
else
{
//valid hostaname for a SMTP server
}
This is not stateless and hence i am assuming that i need to do something more since if i enter "yahoo.com" for SMTP server, the code jumps into the else part of the above conditional.
Please suggest.
Thanks, Nishi.
I am calling the following code to validate whether the hostname entered on a page in a J2EE application is a valid SMTP server
Session _session = null;
Properties props = System.getProperties();
props.put("mail.smtp.host", hostname); //hostname passed from the page to the backend code
_session = Session.getDefaultInstance(props,null);
if ( session = = null )
{
//invalid hostname provided for a SMTP server
}
else
{
//valid hostaname for a SMTP server
}
This is not stateless and hence i am assuming that i need to do something more since if i enter "yahoo.com" for SMTP server, the code jumps into the else part of the above conditional.
Please suggest.
Thanks, Nishi.