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