Java mail API or Mail server does not varify username and password
843830Feb 14 2006 — edited Aug 17 2007Hi All,
I really need ur help.
I have a client which tries to connect to mail server while sending a mail.
Problem is Java mail API or Mail server does not varify username and password while sending the mail.
code is below
props.put("mail.host", mailhost);
props.put("mail.Transport.protocol", "smtp");
props.put("mail.smtp.port","26");
props.put("mail.smtp.auth","true");
SSAuthenticator auth=new SSAuthenticator("email","user");
// Get a Session object
Session session = Session.getInstance(props, auth);
session.setDebug(true);
Transport transport=null;
try
{
transport = session.getTransport("smtp");
}
catch(NoSuchProviderException e)
{
System.out.println("wrong id");
}
String username="email";
try{
transport.connect(mailhost,username,"user");
}
catch(MessagingException me)
{
System.out.println("username and password are wrong");
}
------------------------------------------
when transport.connect () is executed, i think api should verify with server for user accound password specified. but that is not happaning. Is Transport object is not a connection object that can be used to send mails. i dont want to use store as my applicatin is not reading any mails from mailbox.My application just sends the mail thats it.
What i want is- how to force server to verify these account name and password before sending mail.
thanks
Swamy