邮箱监控界面,添加和修改功能添加邮箱服务器类型,增加emailServerType字段
This commit is contained in:
parent
846880b256
commit
227466ab0a
|
@ -19,6 +19,7 @@ import org.jeecg.common.util.DateUtils;
|
|||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.entity.postgre.SysEmail;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.mail.*;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
@ -53,13 +54,21 @@ public class EmailServiceManager {
|
|||
* 系统启动时间
|
||||
*/
|
||||
private Date systemStartupTime;
|
||||
/** 邮件接收数量 */
|
||||
/**
|
||||
* 邮件接收数量
|
||||
*/
|
||||
private Integer receiveNum;
|
||||
/** smtp协议的存储对象 */
|
||||
/**
|
||||
* smtp协议的存储对象
|
||||
*/
|
||||
private IMAPStore store = null;
|
||||
/** 邮件附件临时存储路径 */
|
||||
/**
|
||||
* 邮件附件临时存储路径
|
||||
*/
|
||||
private String temporaryStoragePath;
|
||||
/** 收件箱 */
|
||||
/**
|
||||
* 收件箱
|
||||
*/
|
||||
private Folder folder = null;
|
||||
|
||||
private RedisUtil redisUtil;
|
||||
|
@ -75,6 +84,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 初始化邮件服务管理器
|
||||
*
|
||||
* @param email 邮件属性
|
||||
*/
|
||||
public void init(SysEmail email) {
|
||||
|
@ -83,6 +93,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 初始化邮件服务管理器
|
||||
*
|
||||
* @param email 邮件属性
|
||||
*/
|
||||
public void init(SysEmail email, Integer receiveNum, String temporaryStoragePath,
|
||||
|
@ -155,8 +166,10 @@ public class EmailServiceManager {
|
|||
store = (IMAPStore) session.getStore();
|
||||
//连接
|
||||
store.connect(email.getUsername(), email.getPassword());
|
||||
if (email.getEmailServerType() == 1) {
|
||||
// 解决163普通邮箱无法建立连接问题
|
||||
store.id(IAM);
|
||||
}
|
||||
//获取收件箱
|
||||
folder = store.getFolder("INBOX");//INBOX
|
||||
folder.open(Folder.READ_WRITE);
|
||||
|
@ -443,6 +456,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 获取邮件主题
|
||||
*
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
|
@ -465,6 +479,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 获取邮件内容
|
||||
*
|
||||
* @param part
|
||||
* @return
|
||||
* @throws MessagingException
|
||||
|
@ -484,6 +499,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 保存邮件附件
|
||||
*
|
||||
* @param part
|
||||
* @throws MessagingException
|
||||
* @throws IOException
|
||||
|
@ -709,8 +725,10 @@ public class EmailServiceManager {
|
|||
public void a(AtomicReference<FileOutputStream> outputStream, Message message) throws MessagingException, IOException {
|
||||
message.writeTo(outputStream.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除邮件
|
||||
*
|
||||
* @param message
|
||||
* @throws MessagingException
|
||||
*/
|
||||
|
@ -764,6 +782,7 @@ public class EmailServiceManager {
|
|||
/**
|
||||
* 校验邮件
|
||||
* 若此次获取的邮件是上次删除失败的邮件直接删除
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public boolean check(Message message, String messageId) {
|
||||
|
|
|
@ -36,4 +36,6 @@ public class EmailDto implements Serializable {
|
|||
private String username; // 邮箱用户名
|
||||
|
||||
private Integer isQiye; // 是否企业邮箱
|
||||
|
||||
private Integer emailServerType;
|
||||
}
|
||||
|
|
|
@ -94,4 +94,7 @@ public class SysEmail implements Serializable {
|
|||
*/
|
||||
@TableField(value = "update_by")
|
||||
private String updateBy;
|
||||
|
||||
@TableField(value = "email_server_type")
|
||||
private Integer emailServerType;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
e.is_qiye,
|
||||
e.enabled,
|
||||
e.email_server_address,
|
||||
e.email_server_type,
|
||||
COUNT (l.id) AS alarms
|
||||
FROM
|
||||
sys_email e
|
||||
|
|
Loading…
Reference in New Issue
Block a user