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