Commit 990ec040 authored by Quxl's avatar Quxl

x

parent be3f5ba4
......@@ -79,13 +79,11 @@ 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) {
Properties properties = new Properties();
properties.put("mail.smtp.host", host);
properties.put("mail.smtp.auth", is_auth ? "true" : "false");
if(port != null) {
properties.put("mail.smtp.port", port);
}
properties.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
properties.setProperty("mail.smtp.socketFactory.port", String.valueOf(port));
properties.put("mail.smtp.host", host);
properties.put("mail.smtp.port", port);
properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
properties.put("mail.smtp.socketFactory.port", port);
try {
Session session = is_auth ? Session.getDefaultInstance(properties, new Authenticator() {
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