Revert "fix:修改gamma报告 #MINIMUM 部分,mdc标题增加单位,mda没数据则不显示"

This reverts commit cca97c9ca8.
This commit is contained in:
xiaoguangbin 2024-10-29 16:08:35 +08:00
parent cca97c9ca8
commit 7227b70fa8

View File

@ -1,83 +0,0 @@
package org.jeecg.common.util;
import cn.hutool.core.util.StrUtil;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Date;
import java.util.Objects;
public class MyMailUtil {
private Integer port;
public MyMailUtil(Integer port){
this.port = port;
}
/**
* 获取邮件主题
* @param message
* @return
*/
public static String getSubject(Message message) throws MessagingException{
String subject = null;
try {
subject = message.getSubject();
} catch (MessagingException e) {
try {
subject = message.getHeader("subject")[0];
} catch (MessagingException ex) {
throw new RuntimeException(ex);
}
}
return subject;
}
public static Date getReceivedDate(Message message) throws MessagingException{
Date receivedDate = null;
try {
receivedDate = message.getReceivedDate();
} catch (MessagingException e) {
try {
receivedDate = new Date(message.getHeader("Date")[0]);
} catch (MessagingException ex) {
throw new RuntimeException(ex);
}
}
return receivedDate;
}
public static String getMessageID(Message message) throws MessagingException{
String messageId = "";
try {
messageId = ((MimeMessage) message).getMessageID();
} catch (MessagingException e) {
try {
messageId = Objects.isNull(message.getHeader("Message-ID")) ? "" : message.getHeader("Message-ID")[0];
} catch (MessagingException ex) {
throw new RuntimeException(ex);
}
}
return messageId;
}
public static String getAddress(Message message) throws MessagingException{
String address = "";
try {
address = ((InternetAddress) message.getFrom()[0]).getAddress();
} catch (MessagingException e) {
try {
String[] froms = message.getHeader("From");
if (null != froms) {
address = StrUtil.subBetween(froms[0], "<",">");
}
} catch (MessagingException ex) {
throw new RuntimeException(ex);
}
}
return address;
}
}