This is an automated email from the ASF dual-hosted git repository.
journey pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 68db6a7 #3542 Optimized mail configuration (#3544)
68db6a7 is described below
commit 68db6a75b4db590a40826352353dfd1d27d86a8b
Author: felix.wang <[email protected]>
AuthorDate: Wed Aug 19 16:28:47 2020 +0800
#3542 Optimized mail configuration (#3544)
* #3542 Optimized mail configuration
* #3542 Optimized mail configuration
Co-authored-by: wangjianda <[email protected]>
---
.../org/apache/dolphinscheduler/alert/utils/MailUtils.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git
a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
index 6f67462..888c9db 100644
---
a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
+++
b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
@@ -59,7 +59,7 @@ public class MailUtils {
public static final String STARTTLS_ENABLE =
PropertyUtils.getString(Constants.MAIL_SMTP_STARTTLS_ENABLE);
- public static final String SSL_ENABLE =
PropertyUtils.getString(Constants.MAIL_SMTP_SSL_ENABLE);
+ public static final Boolean SSL_ENABLE =
PropertyUtils.getBoolean(Constants.MAIL_SMTP_SSL_ENABLE);
public static final String SSL_TRUST =
PropertyUtils.getString(Constants.MAIL_SMTP_SSL_TRUST);
@@ -213,6 +213,7 @@ public class MailUtils {
/**
* get session
+ *
* @return the new Session
*/
private static Session getSession() {
@@ -222,8 +223,10 @@ public class MailUtils {
props.setProperty(Constants.MAIL_SMTP_AUTH, Constants.STRING_TRUE);
props.setProperty(Constants.MAIL_TRANSPORT_PROTOCOL, MAIL_PROTOCOL);
props.setProperty(Constants.MAIL_SMTP_STARTTLS_ENABLE,
STARTTLS_ENABLE);
- props.setProperty(Constants.MAIL_SMTP_SSL_ENABLE, SSL_ENABLE);
- props.setProperty(Constants.MAIL_SMTP_SSL_TRUST, SSL_TRUST);
+ if (SSL_ENABLE) {
+ props.setProperty(Constants.MAIL_SMTP_SSL_ENABLE, "true");
+ props.setProperty(Constants.MAIL_SMTP_SSL_TRUST, SSL_TRUST);
+ }
Authenticator auth = new Authenticator() {
@Override
@@ -345,5 +348,5 @@ public class MailUtils {
retMap.put(Constants.MESSAGE, "Send email to {" + String.join(",",
receivers) + "} failed," + e.toString());
}
-
+
}