Email - Enviar Email com SSL/TLS



  • Boa tarde!!

    Estou utilizando a função "Email - Enviar Email com SSL/TLS" com os seguinte parametros

    1. Servidor smtp.gmail.com
    2. Porta 465
    3. 2 - Com SSL 2
    4. Usuário slbighetti@gmail.com
    5. Senha xczczxc
    6. Remetente slbighetti@gmail.com
    7. Destinatários destino@teste.com.br
    8. Assunto teste
    9. Mensagem teste
    10. HTML true


    Exceção Gerada:
    javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:[color=#FF0000] unable to find valid certification path to requested[/color] target at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1611) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412) at javax.mail.Service.connect(Service.java:310) at javax.mail.Service.connect(Service.java:169) at javax.mail.Service.connect(Service.java:118) at javax.mail.Transport.send0(Transport.java:188) at javax.mail.Transport.send(Transport.java:118) at wfr.com.systems.system_tre.rules.WebrunFunctions.ebfSendAuthenticatedEmail2(WebrunFunctions.java:12151) at wfr.com.systems.system_tre.rules.EnviarEmail.run(EnviarEmail.java:56) at wfr.rules.WFRRule.start(WFRRule.java:755) at wfr.rules.WFRRule.call(WFRRule.java:1817) at wfr.rules.WFRRule.call(WFRRule.java:58) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1518) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:848) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:818) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1030) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:678) at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589) ... 17 more Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145) at sun.security.validator.Validator.validate(Validator.java:203) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172) at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841) ... 29 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:236) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216) ... 34 more

    Causa:
    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1518) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:848) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:818) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1030) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:678) at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412) at javax.mail.Service.connect(Service.java:310) at javax.mail.Service.connect(Service.java:169) at javax.mail.Service.connect(Service.java:118) at javax.mail.Transport.send0(Transport.java:188) at javax.mail.Transport.send(Transport.java:118) at wfr.com.systems.system_tre.rules.WebrunFunctions.ebfSendAuthenticatedEmail2(WebrunFunctions.java:12151) at wfr.com.systems.system_tre.rules.EnviarEmail.run(EnviarEmail.java:56) at wfr.rules.WFRRule.start(WFRRule.java:755) at wfr.rules.WFRRule.call(WFRRule.java:1817) at wfr.rules.WFRRule.call(WFRRule.java:58) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145) at sun.security.validator.Validator.validate(Validator.java:203) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172) at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841) ... 29 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:236) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216) ... 34 more

    Causa:
    sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: [b]unable to find valid certification path to requested[/b] target at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145) at sun.security.validator.Validator.validate(Validator.java:203) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172) at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:818) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1030) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:678) at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412) at javax.mail.Service.connect(Service.java:310) at javax.mail.Service.connect(Service.java:169) at javax.mail.Service.connect(Service.java:118) at javax.mail.Transport.send0(Transport.java:188) at javax.mail.Transport.send(Transport.java:118) at wfr.com.systems.system_tre.rules.WebrunFunctions.ebfSendAuthenticatedEmail2(WebrunFunctions.java:12151) at wfr.com.systems.system_tre.rules.EnviarEmail.run(EnviarEmail.java:56) at wfr.rules.WFRRule.start(WFRRule.java:755) at wfr.rules.WFRRule.call(WFRRule.java:1817) at wfr.rules.WFRRule.call(WFRRule.java:58) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:236) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216) ... 34 more

    Causa:
    sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:236) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145) at sun.security.validator.Validator.validate(Validator.java:203) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172) at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:818) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1030) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:678) at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412) at javax.mail.Service.connect(Service.java:310) at javax.mail.Service.connect(Service.java:169) at javax.mail.Service.connect(Service.java:118) at javax.mail.Transport.send0(Transport.java:188) at javax.mail.Transport.send(Transport.java:118) at wfr.com.systems.system_tre.rules.WebrunFunctions.ebfSendAuthenticatedEmail2(WebrunFunctions.java:12151) at wfr.com.systems.system_tre.rules.EnviarEmail.run(EnviarEmail.java:56) at wfr.rules.WFRRule.start(WFRRule.java:755) at wfr.rules.WFRRule.call(WFRRule.java:1817) at wfr.rules.WFRRule.call(WFRRule.java:58) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595)


    Alguem tem alguma dica ?


  • Boa tarde!!
    Ao quebrar a cabeça com varias configurações e sem obter resultado, peguei uma função DESCONTINUADA de envio de e-mail e criei uma função XEMAIL e coloquei o codigo descontinuado nesta função.
    SEGUE O CODIGO:
    [code] protected final Variant ebfSendMail(Variant serverVar, Variant userVar, Variant passwordVar, Variant fromVar, Variant toVar, Variant subjectVar, Variant bodyVar) throws Exception { // Classe para autenticação class SimpleAuthenticator extends javax.mail.Authenticator { private String user; private String password; SimpleAuthenticator(String user, String password) { this.user = user; this.password = password; } /** * @see javax.mail.Authenticator#getPasswordAuthentication() */ @Override protected javax.mail.PasswordAuthentication getPasswordAuthentication() { return new javax.mail.PasswordAuthentication(this.user, this.password); } } // Propriedades para envio de email Properties properties = new Properties(); properties.put("mail.smtp.host", serverVar.getString().trim()); properties.put("mail.transport.protocol", "smtp"); properties.put("mail.smtp.port", "587"); properties.put("mail.debug", "true"); // Caso necessite de SSL // properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); javax.mail.Authenticator authenticator = null; if (userVar.getTrimString().length() > 0) { properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.user", userVar.getTrimString()); properties.put("mail.smtp.password", passwordVar.getTrimString()); authenticator = new SimpleAuthenticator(userVar.getTrimString(), passwordVar.getTrimString()); } // Configurações de proxy String proxySet = System.getProperty("proxySet"); if (proxySet != null && proxySet.equalsIgnoreCase("true")) { properties.put("proxySet", "true"); properties.put("socksProxyHost", System.getProperty("http.proxyHost")); properties.put("socksProxyPort", System.getProperty("http.proxyPort")); } javax.mail.Session session; if (authenticator == null) { session = javax.mail.Session.getInstance(properties); } else { session = javax.mail.Session.getInstance(properties, authenticator); } javax.mail.internet.MimeMessage message = new javax.mail.internet.MimeMessage(session); message.setFrom(new javax.mail.internet.InternetAddress(fromVar.getString().trim())); message.addRecipient(javax.mail.Message.RecipientType.TO, new javax.mail.internet.InternetAddress(toVar.getString().trim())); message.setSentDate(new Date()); message.setSubject(subjectVar.getString().trim()); message.setContent(bodyVar.getString(), "text/html"); javax.mail.Transport.send(message); return Variant.VARIANT_NULL; } [/code] [color=#FF0000] Para meu espando a função antiga funciona. Por tanto, acho que existe algo errado com a função atual (MAKER 3.5) de envio de e-mail[/color]


  • estou com o mesmo problema e nao consigo resolver nem no maker 2.7 e nem no maker 3.7
    o que aconteceu com essa função que funcionava bem
    depois que foi feito alguma atualizacao da webrun tudo mudou
    alguem poderia nos ajudar


  • Pelo erro apresentado,

    Aparentemente está relacionado ao certificado digital. Está utilizando enviar email com certificado?!

Log in to reply