Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java mail API or Mail server does not varify username and password

843830Feb 14 2006 — edited Aug 17 2007
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 14 2007
Added on Feb 14 2006
5 comments
741 views