2
Hello. I’m trying to send an email through java and I’m using Commons-mail and javamail for this. Más está dando erro... It follows method. I already changed the .." Allow less secure apps" in gmail
public void enviarEmail(String emailDeDestino, String assunto, String corpo)throws EmailException {
Email email = new SimpleEmail();
email.setHostName("smtp.googlemail.com");
email.setAuthentication("[email protected]", "XXXXXXXXXX");
email.setSSLOnConnect(true);
email.setFrom(emailDeDestino);
email.setSubject(assunto);
email.setMsg(corpo);
email.addTo(emailDeDestino);
email.send();
}