Share & Learn

Monday, June 04, 2007

"Must Specify STARTTLS Command First" error while using JavaMail API


I tried the JavaMail API (v1.4) , and let me tell you guys when you send the mail through browser you have to specify the SSL provider, and the older method of using the SSL provider class, does not work.

So guys here is the actual code that you should actually implement in your code:
The error that Java generally throws is "Must Specify STARTTLS Command first"

props.put("mail.smtp.socketFactory.port", SMTP_PORT);
props.put("mail.smtp.socketFactory.class", "");
props.put("mail.smtp.socketFactory.fallback", "false");

paste this code before using the Authenticator.

I had a torrid time, rectifying the error. So friends, here is that code snippet that could make your life a bit easier


blog comments powered by Disqus
blog comments powered by Disqus