diff --git a/notify-email/pom.xml b/notify-email/pom.xml index 8e574ef..556c285 100644 --- a/notify-email/pom.xml +++ b/notify-email/pom.xml @@ -42,11 +42,7 @@ spring-web 5.2.10.RELEASE - - org.hswebframework.web - hsweb-core - 4.0.11-SNAPSHOT - + org.springframework.boot spring-boot diff --git a/notify-email/src/main/java/com/simaek/notify/email/embedded/DefaultEmailNotifier.java b/notify-email/src/main/java/com/simaek/notify/email/embedded/DefaultEmailNotifier.java index 7dff7b8..0e47e8e 100644 --- a/notify-email/src/main/java/com/simaek/notify/email/embedded/DefaultEmailNotifier.java +++ b/notify-email/src/main/java/com/simaek/notify/email/embedded/DefaultEmailNotifier.java @@ -6,11 +6,6 @@ import com.cicdi.notify.template.TemplateManager; import com.simaek.notify.email.EmailProvider; import com.simaek.notify.email.EmailTemplate; import com.simaek.notify.email.EmailTemplateParsed; -import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeUtility; -import org.hswebframework.web.exception.BusinessException; -import org.hswebframework.web.id.IDGenerator; -import org.hswebframework.web.utils.ExpressionUtils; -import org.hswebframework.web.validator.ValidatorUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -23,20 +18,15 @@ import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.util.StringUtils; import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; +import java.util.*; /** * 使用javax.mail进行邮件发送 @@ -167,7 +157,7 @@ public class DefaultEmailNotifier extends AbstractNotifier { String subject = template.getSubject(); String text = template.getText(); if (StringUtils.isEmpty(subject) || StringUtils.isEmpty(text)) { - throw new BusinessException("模板内容错误,text 或者 subject 不能为空."); +// throw new BusinessException("模板内容错误,text 或者 subject 不能为空."); } String sendText = render(text, context); List tempAttachments = template.getAttachments(); @@ -194,7 +184,7 @@ public class DefaultEmailNotifier extends AbstractNotifier { if (s.startsWith("http")) { continue; } - String tempKey = IDGenerator.MD5.generate(); + String tempKey = UUID.randomUUID().toString(); src.attr("src", "cid:".concat(tempKey)); images.put(tempKey, s); } @@ -202,7 +192,8 @@ public class DefaultEmailNotifier extends AbstractNotifier { } private String render(String str, Map context) { - return ExpressionUtils.analytical(str, context, "spel"); + return str; +// return ExpressionUtils.analytical(str, context, "spel"); } }