Fiz uma classe java com api do JavaMail… ele esta dando este erro, oq faco?
Exception in thread “main” org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
at org.apache.commons.mail.Email.send(Email.java:1163)
at Mail.main(Mail.java:18)
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. 22sm16403584wfg.13
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1515)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1054)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:634)
at javax.mail.Transport.send0(Transport.java:189)
at javax.mail.Transport.send(Transport.java:118)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1128)
... 2 more
meu codigo eh esse
[code]import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
public class Mail{
public static void main(String args[]) throws EmailException{
SimpleEmail email = new SimpleEmail();
email.setHostName("smtp.gmail.com");
email.setAuthentication("luksbdit@gmail.com", "minhasenha");
email.addTo("luksbd@hotmail.com", "Lucas");
email.setFrom("luksbdit@gmail.com", "Lucas Gmail");
email.setSubject("Test message");
email.setMsg("This is a simple test of commons-email");
email.send();
}
}[/code]
Obrg