|
@@ -178,7 +178,7 @@ public class EmailUtil {
|
|
|
String html = partContent.toString();
|
|
|
try{
|
|
|
if(contentType.indexOf("charset=") != -1){
|
|
|
- contentType = contentType.substring(contentType.indexOf("charset=")+8,contentType.length());
|
|
|
+ contentType = contentType.substring(contentType.indexOf("charset=")+8,contentType.length()).replaceAll("\"","");
|
|
|
html = html.replace("charset="+contentType.toLowerCase(),"charset=UTF-8");
|
|
|
html = html.replace("charset="+contentType.toUpperCase(),"charset=UTF-8");
|
|
|
}
|
|
@@ -298,12 +298,12 @@ public class EmailUtil {
|
|
|
return props;
|
|
|
}
|
|
|
|
|
|
- public static void senEmail(MailboxInfoDTO mailboxInfoDTO, String emails, File file,String htmlText) throws Exception {
|
|
|
+ public static void senEmail(MailboxInfoDTO mailboxInfoDTO, String emails, File file,String htmlText,String host,String emailTitle) throws Exception {
|
|
|
logger.info("send email begin .........");
|
|
|
// 根据Session 构建邮件信息
|
|
|
MimeMessage message = new MimeMessage(getSession(mailboxInfoDTO));
|
|
|
// 创建邮件发送者地址
|
|
|
- Address from = new InternetAddress(mailboxInfoDTO.getAccount());
|
|
|
+ Address from = new InternetAddress(mailboxInfoDTO.getAccount()+host);
|
|
|
String[] emailArr = emails.split(";");
|
|
|
Address[] toArr = new Address[emailArr.length];
|
|
|
for (int idx = 0; idx < emailArr.length; idx++) {
|
|
@@ -315,7 +315,7 @@ public class EmailUtil {
|
|
|
message.setFrom(from);
|
|
|
message.setRecipients(Message.RecipientType.TO, toArr);
|
|
|
// 邮件主题
|
|
|
- message.setSubject("产品净值补发");
|
|
|
+ message.setSubject(emailTitle);
|
|
|
// 邮件容器
|
|
|
MimeMultipart mimeMultiPart = new MimeMultipart();
|
|
|
// 设置HTML
|
|
@@ -345,7 +345,8 @@ public class EmailUtil {
|
|
|
properties.put("mail.smtp.host", mailboxInfoDTO.getHost());
|
|
|
properties.put("mail.smtp.auth", true);
|
|
|
properties.setProperty("mail.smtp.port", mailboxInfoDTO.getPort());
|
|
|
- properties.put("mail.smtp.ssl.enable", true);
|
|
|
+ properties.put("mail.smtp.ssl.enable", false);
|
|
|
+ properties.put("mail.smtp.ssl.required", false);
|
|
|
// 根据邮件的会话属性构造一个发送邮件的Session,
|
|
|
JakartaUserPassAuthenticator authenticator = new JakartaUserPassAuthenticator(mailboxInfoDTO.getAccount(), mailboxInfoDTO.getPassword());
|
|
|
Session session = Session.getInstance(properties, authenticator);
|