添加邮箱服务器类型标记
This commit is contained in:
parent
1c4b4af39c
commit
2d96fbe7d0
|
@ -21,6 +21,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;
|
||||
|
@ -56,13 +57,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;
|
||||
|
@ -78,6 +87,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 初始化邮件服务管理器
|
||||
*
|
||||
* @param email 邮件属性
|
||||
*/
|
||||
public void init(SysEmail email) {
|
||||
|
@ -86,6 +96,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 初始化邮件服务管理器
|
||||
*
|
||||
* @param email 邮件属性
|
||||
*/
|
||||
public void init(SysEmail email, Integer receiveNum, String temporaryStoragePath,
|
||||
|
@ -158,8 +169,12 @@ 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);
|
||||
|
@ -446,6 +461,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 获取邮件主题
|
||||
*
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
|
@ -468,6 +484,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 获取邮件内容
|
||||
*
|
||||
* @param part
|
||||
* @return
|
||||
* @throws MessagingException
|
||||
|
@ -487,6 +504,7 @@ public class EmailServiceManager {
|
|||
|
||||
/**
|
||||
* 保存邮件附件
|
||||
*
|
||||
* @param part
|
||||
* @throws MessagingException
|
||||
* @throws IOException
|
||||
|
@ -713,8 +731,10 @@ public class EmailServiceManager {
|
|||
public void a(AtomicReference<FileOutputStream> outputStream, Message message) throws MessagingException, IOException {
|
||||
message.writeTo(outputStream.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除邮件
|
||||
*
|
||||
* @param message
|
||||
* @throws MessagingException
|
||||
*/
|
||||
|
@ -768,6 +788,7 @@ public class EmailServiceManager {
|
|||
/**
|
||||
* 校验邮件
|
||||
* 若此次获取的邮件是上次删除失败的邮件直接删除
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public boolean check(Message message, String messageId) {
|
||||
|
|
|
@ -94,4 +94,6 @@ public class SysEmail implements Serializable {
|
|||
*/
|
||||
@TableField(value = "update_by")
|
||||
private String updateBy;
|
||||
@TableField(value = "email_server_type")
|
||||
private Integer emailServerType;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user