update austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EmailHandler.java.

fix files null 

Signed-off-by: Java3y <1621094+zhongfucheng@user.noreply.gitee.com>
pull/26/head
Java3y 2 years ago committed by Gitee
parent 7c8b9e7b4a
commit 24a45e9a0d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -56,7 +56,8 @@ public class EmailHandler extends BaseHandler implements Handler {
MailAccount account = getAccountConfig(taskInfo.getSendAccount());
try {
File file = StrUtil.isNotBlank(emailContentModel.getUrl()) ? AustinFileUtils.getRemoteUrl2File(dataPath, emailContentModel.getUrl()) : null;
MailUtil.send(account, taskInfo.getReceiver(), emailContentModel.getTitle(), emailContentModel.getContent(), true, file);
String result = Objects.isNull(file) ? MailUtil.send(account, taskInfo.getReceiver(), emailContentModel.getTitle(), emailContentModel.getContent(), true) :
MailUtil.send(account, taskInfo.getReceiver(), emailContentModel.getTitle(), emailContentModel.getContent(), true, file);
} catch (Exception e) {
log.error("EmailHandler#handler fail!{},params:{}", Throwables.getStackTraceAsString(e), taskInfo);
return false;

Loading…
Cancel
Save