【优化】新增 sslEnable 字段,支持 outlook 邮箱

This commit is contained in:
YunaiV 2024-04-24 09:14:51 +08:00
parent 7f0485e872
commit 0649c315d1
5 changed files with 14 additions and 1 deletions

View File

@ -30,6 +30,9 @@ public class MailAccountRespVO {
@Schema(description = "是否开启 ssl", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean sslEnable;
@Schema(description = "是否开启 starttls", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean starttlsEnable;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;

View File

@ -38,4 +38,8 @@ public class MailAccountSaveReqVO {
@NotNull(message = "是否开启 ssl 必填")
private Boolean sslEnable;
@Schema(description = "是否开启 starttls", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "是否开启 starttls 必填")
private Boolean starttlsEnable;
}

View File

@ -49,5 +49,9 @@ public class MailAccountDO extends BaseDO {
* 是否开启 SSL
*/
private Boolean sslEnable;
/**
* 是否开启 STARTTLS
*/
private Boolean starttlsEnable;
}

View File

@ -120,7 +120,8 @@ public class MailSendServiceImpl implements MailSendService {
String from = StrUtil.isNotEmpty(nickname) ? nickname + " <" + account.getMail() + ">" : account.getMail();
return new MailAccount().setFrom(from).setAuth(true)
.setUser(account.getUsername()).setPass(account.getPassword().toCharArray())
.setHost(account.getHost()).setPort(account.getPort()).setSslEnable(account.getSslEnable());
.setHost(account.getHost()).setPort(account.getPort())
.setSslEnable(account.getSslEnable()).setStarttlsEnable(account.getStarttlsEnable());
}
@VisibleForTesting

View File

@ -520,6 +520,7 @@ CREATE TABLE IF NOT EXISTS "system_mail_account" (
"host" varchar NOT NULL,
"port" int NOT NULL,
"ssl_enable" bit NOT NULL,
"starttls_enable" bit NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',