Browse Source

Update MailUtils.java

if there is no receivers && no receiversCc, no need to process
pull/1/MERGE
乔占卫 6 years ago committed by GitHub
parent
commit
4fbd9380de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      escheduler-alert/src/main/java/cn/escheduler/alert/utils/MailUtils.java

9
escheduler-alert/src/main/java/cn/escheduler/alert/utils/MailUtils.java

@ -102,16 +102,15 @@ public class MailUtils {
*/ */
public static Map<String,Object> sendMails(Collection<String> receivers, Collection<String> receiversCc, String title, String content, ShowType showType) { public static Map<String,Object> sendMails(Collection<String> receivers, Collection<String> receiversCc, String title, String content, ShowType showType) {
Map<String,Object> retMap = new HashMap<>(); Map<String,Object> retMap = new HashMap<>();
retMap.put(Constants.STATUS, false);
receivers.removeIf((from) -> (StringUtils.isEmpty(from)));
// if there is no receivers && no receiversCc, no need to process // if there is no receivers && no receiversCc, no need to process
if (CollectionUtils.isEmpty(receivers) && CollectionUtils.isEmpty(receiversCc)) { if (CollectionUtils.isEmpty(receivers) && CollectionUtils.isEmpty(receiversCc)) {
retMap.put(Constants.STATUS, true);
return retMap; return retMap;
} }
retMap.put(Constants.STATUS, false); receivers.removeIf((from) -> (StringUtils.isEmpty(from)));
if (showType == ShowType.TABLE || showType == ShowType.TEXT){ if (showType == ShowType.TABLE || showType == ShowType.TEXT){
// send email // send email
HtmlEmail email = new HtmlEmail(); HtmlEmail email = new HtmlEmail();

Loading…
Cancel
Save