From 54e9a5bf04701f13a67c71a125fe81237f2ff4f2 Mon Sep 17 00:00:00 2001 From: "lucas.taia" Date: Thu, 25 Mar 2021 20:35:58 +0000 Subject: [PATCH] bug#19589 dev:lucas qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@105934 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/utilerias/SendMail.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java b/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java index 1d57e0aa3..8594b8ad5 100644 --- a/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java +++ b/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java @@ -38,6 +38,8 @@ public class SendMail implements java.io.Serializable { private static final String ENCODE_UTF_8 = "UTF-8"; private static final long serialVersionUID = 2067442255080001075L; + + public enum AuthType {TLS,SSL} private String smtpHost; private String smtpUser; @@ -54,6 +56,7 @@ public class SendMail implements java.io.Serializable { private Map anexosBytes; private Map anexosArquivos; private Map mimeTypes; + private AuthType authType; public SendMail(){ this.smtpHost = ""; @@ -63,6 +66,7 @@ public class SendMail implements java.io.Serializable { this.emailFrom = ""; this.localhost = ""; this.auth = true; + this.authType = AuthType.TLS; this.emailTo = ""; this.emailToCO = ""; } @@ -250,7 +254,13 @@ public class SendMail implements java.io.Serializable { } if (auth) { - props.setProperty("mail.smtp.starttls.enable", "true"); + if (authType.equals(AuthType.TLS)) { + props.setProperty("mail.smtp.starttls.enable", "true"); + } else { + props.put("mail.smtp.socketFactory.port", smtpPort); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + } + props.setProperty("mail.smtp.user", smtpUser); } @@ -393,4 +403,13 @@ public class SendMail implements java.io.Serializable { public void setAnexosArquivos(Map anexosArquivos) { this.anexosArquivos = anexosArquivos; } + + public AuthType getAuthType() { + return authType; + } + + public void setAuthType(AuthType authType) { + this.authType = authType; + } + } \ No newline at end of file