Olá Samir, sim eu não iria envolver o JSF, seria um processo automático do java, eu andei fazendo uns testes com Commons email mas não deram muito certo.
public class ExecutavelCommons {
public static void main(String[] args) {
SimpleEmail email = new SimpleEmail();
try {
email.setDebug(true);
email.setHostName("smtp.gmail.com");
email.setAuthentication("felipe.210296@gmail.com","minha senha");
email.setSSL(true);
email.addTo("felipe.210296@gmail.com"); //pode ser qualquer email
email.setFrom("felipe.210296@gmail.com"); //será passado o email que você fará a autenticação
email.setSubject("Enviando email");
email.setMsg("Teste de envio de email");
System.out.println("Enviando....");
email.send();
System.out.println("E-mail Enviado!");
} catch (EmailException e) {
System.out.println(e.getMessage());
}
}
}
Mas o erro persiste mesmo adicionando todas as Bibliotecas possiveis que são activation.jar, commons-email, java-mail, javamail, mail.jar
Enviando....
DEBUG: JavaMail version 1.3.1
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.8.0_51\jre\lib\javamail.providers (O sistema não pode encontrar o arquivo especificado)
DEBUG: URL jar:file:/C:/Users/felipe.vasconcellos/Downloads/javamail-smtp-1.4.2.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/C:/Users/felipe.vasconcellos/Downloads/javamail-smtp-1.4.2.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: {imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: URL jar:file:/C:/Users/felipe.vasconcellos/Downloads/javamail-smtp-1.4.2.jar!/META-INF/javamail.address.map
DEBUG: successfully loaded resource: jar:file:/C:/Users/felipe.vasconcellos/Downloads/javamail-smtp-1.4.2.jar!/META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.8.0_51\jre\lib\javamail.address.map (O sistema não pode encontrar o arquivo especificado)
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465
220 smtp.gmail.com ESMTP j75sm15932774qke.34 - gsmtp
DEBUG SMTP: connected to host "smtp.gmail.com", port: 465
EHLO OSATI03
250-smtp.gmail.com at your service, [186.230.28.218]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
DEBUG SMTP: Found extension "SIZE", arg "35882577"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "SMTPUTF8", arg ""
DEBUG SMTP: Attempt to authenticate
AUTH LOGIN
334 VXNlcm5hbWU6
ZmVsaXBlLjIxMDI5NkBnbWFpbC5jb20=
334 UGFzc3dvcmQ6
bWluaGEgc2VuaGE=
535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials j75sm15932774qke.34 - gsmtp
Sending the email to the following server failed : smtp.gmail.com:25
CONSTRUÍDO COM SUCESSO (tempo total: 5 segundos)
Alguma sugestão Samir?