Commit 2a4c0189 authored by Quxl's avatar Quxl

x

parent 990ec040
...@@ -79,11 +79,10 @@ public class MailUtil { ...@@ -79,11 +79,10 @@ public class MailUtil {
public static void sendBySmtps(String host, Integer port, boolean is_auth, final String username, final String password, final String from, String subject, String content, File[] attachments, String... emailTo) { public static void sendBySmtps(String host, Integer port, boolean is_auth, final String username, final String password, final String from, String subject, String content, File[] attachments, String... emailTo) {
Properties properties = new Properties(); Properties properties = new Properties();
properties.put("mail.transport.protocol", "smtps");
properties.put("mail.smtp.auth", is_auth ? "true" : "false"); properties.put("mail.smtp.auth", is_auth ? "true" : "false");
properties.put("mail.smtp.host", host); properties.put("mail.smtp.host", host);
properties.put("mail.smtp.port", port); properties.put("mail.smtp.port", port);
properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
properties.put("mail.smtp.socketFactory.port", port);
try { try {
Session session = is_auth ? Session.getDefaultInstance(properties, new Authenticator() { Session session = is_auth ? Session.getDefaultInstance(properties, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() { protected PasswordAuthentication getPasswordAuthentication() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment