Skip to content

Commit 2bd6355

Browse files
author
fxbin
committed
refactor: ♻️ 调增邮件配置项及相关实现
1 parent aaebed4 commit 2bd6355

File tree

4 files changed

+22
-130
lines changed

4 files changed

+22
-130
lines changed

bubble-spring-boot-starters/bubble-spring-boot-starter-mail/src/main/java/cn/fxbin/bubble/mail/MailProperties.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package cn.fxbin.bubble.mail;
22

3+
import com.google.common.collect.Lists;
34
import com.google.common.collect.Maps;
45
import lombok.Data;
56
import org.dromara.email.comm.config.MailSmtpConfig;
67
import org.springframework.boot.context.properties.ConfigurationProperties;
78

9+
import java.util.List;
810
import java.util.Map;
911

1012
import static cn.fxbin.bubble.mail.MailProperties.BUBBLE_MAIL_PREFIX;
@@ -63,6 +65,16 @@ public class MailProperties {
6365
* */
6466
private String isAuth = "true";
6567

68+
/**
69+
* 重试间隔(单位:秒),默认为5秒
70+
*/
71+
private int retryInterval = 5;
72+
73+
/**
74+
* 重试次数,默认为1次
75+
*/
76+
private int maxRetries = 1;
77+
6678
/**
6779
* 多租户配置时需要配置此项,指定默认主租户
6880
*/
@@ -73,4 +85,9 @@ public class MailProperties {
7385
*/
7486
private Map<String, MailSmtpConfig> tenant = Maps.newHashMap();
7587

88+
/**
89+
* 黑名单
90+
*/
91+
private List<String> blacklist = Lists.newArrayList();
92+
7693
}

bubble-spring-boot-starters/bubble-spring-boot-starter-mail/src/main/java/cn/fxbin/bubble/mail/autoconfigure/MailAutoConfiguration.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import cn.fxbin.bubble.core.util.CollectionUtils;
44
import cn.fxbin.bubble.mail.MailProperties;
55
import jakarta.annotation.Resource;
6+
import org.dromara.email.api.Blacklist;
67
import org.dromara.email.api.MailClient;
78
import org.dromara.email.comm.config.MailSmtpConfig;
89
import org.dromara.email.core.factory.MailFactory;
@@ -14,6 +15,7 @@
1415
import org.springframework.context.annotation.Lazy;
1516
import org.springframework.util.Assert;
1617

18+
import java.util.List;
1719
import java.util.Map;
1820

1921
/**
@@ -44,9 +46,11 @@ public MailClient mailClient() {
4446
.fromAddress(properties.getFromAddress())
4547
.isSSL(properties.getIsSsl())
4648
.isAuth(properties.getIsAuth())
49+
.maxRetries(properties.getMaxRetries())
50+
.retryInterval(properties.getRetryInterval())
4751
.build();
4852
MailFactory.put("default", mailSmtpConfig);
49-
return MailFactory.createMailClient("default");
53+
return MailFactory.createMailClient("default", () -> properties.getBlacklist());
5054
}
5155

5256
/**

bubble-spring-boot-starters/bubble-spring-boot-starter-mail/src/main/java/org/dromara/email/comm/utils/HtmlUtil.java

Lines changed: 0 additions & 125 deletions
This file was deleted.

bubble-spring-boot-starters/bubble-spring-boot-starter-mail/src/main/java/org/dromara/email/comm/utils/package-info.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)