This is an automated email from the ASF dual-hosted git repository. benjobs pushed a commit to branch check_mail in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
commit c8d860e5e080bfb54ca6155db00f41e5d1d8c881 Author: benjobs <[email protected]> AuthorDate: Thu Feb 29 17:14:59 2024 +0800 [Improve] email check improvement --- .../console/core/service/impl/SettingServiceImpl.java | 4 +++- .../console/core/service/SettingServiceTest.java | 14 ++++++++++++++ .../src/locales/lang/en/setting/system.ts | 8 ++++---- .../src/locales/lang/zh-CN/setting/system.ts | 8 ++++---- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SettingServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SettingServiceImpl.java index 5a163b52b..f7da3fa7a 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SettingServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SettingServiceImpl.java @@ -157,7 +157,9 @@ public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> ResponseResult result = new ResponseResult(); Properties props = new Properties(); props.put("mail.smtp.auth", "true"); - props.put("mail.smtp.starttls.enable", "true"); + if (senderEmail.isSsl()) { + props.put("mail.smtp.starttls.enable", "true"); + } props.put("mail.smtp.host", senderEmail.getHost()); props.put("mail.smtp.port", senderEmail.getPort()); diff --git a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/SettingServiceTest.java b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/SettingServiceTest.java index 57bfb8542..40ab59621 100644 --- a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/SettingServiceTest.java +++ b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/SettingServiceTest.java @@ -19,6 +19,7 @@ package org.apache.streampark.console.core.service; import org.apache.streampark.console.SpringTestBase; import org.apache.streampark.console.core.bean.DockerConfig; +import org.apache.streampark.console.core.bean.ResponseResult; import org.apache.streampark.console.core.bean.SenderEmail; import org.junit.jupiter.api.Assertions; @@ -84,4 +85,17 @@ class SettingServiceTest extends SpringTestBase { Assertions.assertEquals( "true", settingService.get(SettingService.KEY_ALERT_EMAIL_SSL).getSettingValue()); } + + @Test + void checkEmailTest() { + SenderEmail senderEmail = new SenderEmail(); + senderEmail.setHost("smtp.qq.com"); + senderEmail.setUserName("******@qq.com"); + senderEmail.setPassword("******"); + senderEmail.setFrom("******@qq.com"); + senderEmail.setSsl(true); + senderEmail.setPort(465); + ResponseResult result = settingService.checkEmail(senderEmail); + Assertions.assertEquals(result.getStatus(), 200); + } } diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/en/setting/system.ts b/streampark-console/streampark-console-webapp/src/locales/lang/en/setting/system.ts index 8e856d67b..62edca8b0 100644 --- a/streampark-console/streampark-console-webapp/src/locales/lang/en/setting/system.ts +++ b/streampark-console/streampark-console-webapp/src/locales/lang/en/setting/system.ts @@ -61,19 +61,19 @@ export default { }, port: { label: 'Smtp Port', - desc: 'Smtp Port of the alarm mailbox', + desc: 'Smtp Port of the mailbox', }, from: { label: 'Email Address', - desc: 'Email to send alerts', + desc: 'Your email address used to send alert email', }, userName: { label: 'Email Username', - desc: 'Authentication username used to send alert emails', + desc: 'Authentication username used to send email,generally: your email address', }, password: { label: 'Email Password', - desc: 'Authentication password used to send alarm email', + desc: 'Authentication password used to send alert email', }, ssl: { label: 'SSL enable', diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/setting/system.ts b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/setting/system.ts index fe84288d9..b4839b88f 100644 --- a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/setting/system.ts +++ b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/setting/system.ts @@ -56,16 +56,16 @@ export default { }, email: { host: { - label: '邮件Smtp主机', - desc: '告警邮箱 Smtp主机', + label: '发送邮件服务器', + desc: '发送告警邮件的服务器 Smtp 主机', }, port: { - label: '邮箱Smtp端口', + label: '发送邮件Smtp端口', desc: '告警邮箱 Smtp端口', }, userName: { label: '邮箱用户名', - desc: '用于发送告警邮件的认证用户名', + desc: '发送告警邮件的用户名,一般是你的邮箱地址', }, password: { label: '邮箱密码',
