mirror of https://github.com/halo-dev/halo
feat: add encryption setting for email notifier (#4686)
#### What type of PR is this? /kind improvement /area core /milestone 2.10.x #### What this PR does / why we need it: 为邮件通知发件设置增加加密方式配置 #### Which issue(s) this PR fixes: Fixes #4674 #### Does this PR introduce a user-facing change? ```release-note 为邮件通知发件设置增加加密方式配置 ```pull/4680/head
parent
df22b4b5ea
commit
815f6b82c5
|
@ -107,7 +107,19 @@ public class EmailNotifier implements ReactiveNotifier {
|
||||||
Properties props = javaMailSender.getJavaMailProperties();
|
Properties props = javaMailSender.getJavaMailProperties();
|
||||||
props.put("mail.transport.protocol", "smtp");
|
props.put("mail.transport.protocol", "smtp");
|
||||||
props.put("mail.smtp.auth", "true");
|
props.put("mail.smtp.auth", "true");
|
||||||
props.put("mail.smtp.starttls.enable", "true");
|
if ("SSL".equals(emailSenderConfig.getEncryption())) {
|
||||||
|
props.put("mail.smtp.ssl.enable", "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("TLS".equals(emailSenderConfig.getEncryption())) {
|
||||||
|
props.put("mail.smtp.starttls.enable", "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("NONE".equals(emailSenderConfig.getEncryption())) {
|
||||||
|
props.put("mail.smtp.ssl.enable", "false");
|
||||||
|
props.put("mail.smtp.starttls.enable", "false");
|
||||||
|
}
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
props.put("mail.debug", "true");
|
props.put("mail.debug", "true");
|
||||||
}
|
}
|
||||||
|
@ -154,6 +166,7 @@ public class EmailNotifier implements ReactiveNotifier {
|
||||||
private String password;
|
private String password;
|
||||||
private String host;
|
private String host;
|
||||||
private Integer port;
|
private Integer port;
|
||||||
|
private String encryption;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets email display name.
|
* Gets email display name.
|
||||||
|
|
|
@ -47,6 +47,18 @@ spec:
|
||||||
label: "端口号"
|
label: "端口号"
|
||||||
name: port
|
name: port
|
||||||
validation: required
|
validation: required
|
||||||
|
- $formkit: select
|
||||||
|
if: "$enable"
|
||||||
|
label: "加密方式"
|
||||||
|
name: encryption
|
||||||
|
value: "SSL"
|
||||||
|
options:
|
||||||
|
- label: "SSL"
|
||||||
|
value: "SSL"
|
||||||
|
- label: "TLS"
|
||||||
|
value: "TLS"
|
||||||
|
- label: "不加密"
|
||||||
|
value: "NONE"
|
||||||
---
|
---
|
||||||
apiVersion: notification.halo.run/v1alpha1
|
apiVersion: notification.halo.run/v1alpha1
|
||||||
kind: ReasonType
|
kind: ReasonType
|
||||||
|
|
Loading…
Reference in New Issue