|
|
@ -78,6 +78,7 @@ public class MailSourceTask {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 十分钟获取邮件内容
|
|
|
|
* 十分钟获取邮件内容
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@SneakyThrows
|
|
|
|
@Scheduled(cron = "0 0/10 * * * ? ")
|
|
|
|
@Scheduled(cron = "0 0/10 * * * ? ")
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public void receiveMail() {
|
|
|
|
public void receiveMail() {
|
|
|
@ -85,7 +86,6 @@ public class MailSourceTask {
|
|
|
|
List<Message> list = MailUtil.readMailByIMAP
|
|
|
|
List<Message> list = MailUtil.readMailByIMAP
|
|
|
|
(deliveryProperties.getEmailAddress(), deliveryProperties.getEmailPassword());
|
|
|
|
(deliveryProperties.getEmailAddress(), deliveryProperties.getEmailPassword());
|
|
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
|
|
try {
|
|
|
|
|
|
|
|
for (Message message : list) {
|
|
|
|
for (Message message : list) {
|
|
|
|
// 获取未读的邮件内容 且与之对应
|
|
|
|
// 获取未读的邮件内容 且与之对应
|
|
|
|
if (deliveryProperties.getToEmailAddress().equalsIgnoreCase
|
|
|
|
if (deliveryProperties.getToEmailAddress().equalsIgnoreCase
|
|
|
@ -169,10 +169,6 @@ public class MailSourceTask {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error("=================== the receive mail error message as {} ===========", e.getMessage());
|
|
|
|
|
|
|
|
throw new BadRequestException("接收邮件失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|