# Conflicts:
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailSendServiceImpl.java
This commit is contained in:
YunaiV
2024-04-24 09:40:29 +08:00
21 changed files with 18 additions and 43 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

@@ -21,7 +21,7 @@ public interface RoleMapper extends BaseMapperX<RoleDO> {
.likeIfPresent(RoleDO::getCode, reqVO.getCode())
.eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
.betweenIfPresent(BaseDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(RoleDO::getId));
.orderByAsc(RoleDO::getId));
}
default RoleDO selectByName(String name) {

View File

@@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.system.service.mail;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.mail.*;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
@@ -12,11 +11,12 @@ import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer;
import cn.iocoder.yudao.module.system.service.member.MemberService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.google.common.annotations.VisibleForTesting;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.extra.mail.*;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -119,8 +119,9 @@ public class MailSendServiceImpl implements MailSendService {
private MailAccount buildMailAccount(MailAccountDO account, String nickname) {
String from = StrUtil.isNotEmpty(nickname) ? nickname + " <" + account.getMail() + ">" : account.getMail();
return new MailAccount().setFrom(from).setAuth(true)
.setUser(account.getUsername()).setPass(account.getPassword())
.setHost(account.getHost()).setPort(account.getPort()).setSslEnable(account.getSslEnable());
.setUser(account.getUsername()).setPass(account.getPassword().toCharArray())
.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 '',