Must issue a STARTTLS command first. Sending email with Java and Google Apps

I found the problem. Previously i was using j2ee.jar to import javax.mail.

I removed j2ee.jar from the classpath and downloaded JavaMail 1.4.1 and put into my classpath two jars, smtp.jar and mailapi.jar. I use now smtps instead smtp

Transport transport = session.getTransport("smtps");            

Now Bill the Lizard’s code works.

Leave a Comment