You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/07/01 02:09:30 UTC

[GitHub] [dolphinscheduler] litiliu opened a new pull request, #10721: [fix-10698]fail to send email, when user don't enable smtp auth

litiliu opened a new pull request, #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721

   <!--Thanks very much for contributing to Apache DolphinScheduler. Please review https://dolphinscheduler.apache.org/en-us/community/development/pull-request.html before opening a pull request.-->
   
   
   ## Purpose of the pull request
   this close #10698 
   <!--(For example: This pull request adds checkstyle plugin).-->
   
   ## Brief change log
   
   - support send email with smtp.auth is disabled
   
   <!--*(for example:)*
     - *Add maven-checkstyle-plugin to root pom.xml*
   -->
   ## Verify this pull request
   
   <!--*(Please pick either of the following options)*-->
   
   This pull request is code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   <!--*(example:)*
     - *Added dolphinscheduler-dao tests for end-to-end.*
     - *Added CronUtilsTest to verify the change.*
     - *Manually verified the change by testing locally.* -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911568597


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java:
##########
@@ -105,20 +105,29 @@ public MailSender(Map<String, String> config) {
 
         enableSmtpAuth = config.get(MailParamsConstants.NAME_MAIL_SMTP_AUTH);
 
-        mailUser = config.get(MailParamsConstants.NAME_MAIL_USER);
-        requireNonNull(mailUser, MailParamsConstants.NAME_MAIL_USER + mustNotNull);
+        if (Boolean.TRUE.toString().equalsIgnoreCase(enableSmtpAuth)) {

Review Comment:
   I'm not quite sure about this feature since not using a password is a very unsafe operation. I think we should not provide this way to users. WDYT? @ruanwenjun @caishunfeng 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] EricGao888 closed pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by "EricGao888 (via GitHub)" <gi...@apache.org>.
EricGao888 closed pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth
URL: https://github.com/apache/dolphinscheduler/pull/10721


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911745094


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dolphinscheduler.plugin.alert.email;
+
+import org.apache.dolphinscheduler.alert.api.AlertConstants;
+import org.apache.dolphinscheduler.alert.api.ShowType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class MailSenderTest {
+
+    @Test
+    public void testEnableAuthConstructor() {
+        Map<String, String> enableAuthConfig = new HashMap<>();
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        enableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(enableAuthConfig);
+    }
+
+    @Test
+    public void testDisableAuthConstructor() {
+        Map<String, String> disableAuthConfig = new HashMap<>();
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "false");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        disableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(disableAuthConfig);
+    }

Review Comment:
   You can use this to assert exception.
   `https://www.baeldung.com/junit-assert-exception`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] EricGao888 commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
EricGao888 commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1290140849

   @litiliu May I ask whether you are still interested in following up with this PR? Thanks : )


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] litiliu commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
litiliu commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1191013664

   @caishunfeng  the code style fail has been fixed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] litiliu commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by "litiliu (via GitHub)" <gi...@apache.org>.
litiliu commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1471580085

   > @litiliu May I ask whether you are still interested in following up with this PR? Thanks : )
   
   sorry for replying late, you can close this now,  my Colleague will submit a new PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] litiliu commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
litiliu commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911566292


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,47 @@
+package org.apache.dolphinscheduler.plugin.alert.email;

Review Comment:
   Thanks for review, the license header has been added now, please review again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1212902441

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10721)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL)
   
   [![60.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '60.8%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list) [60.8% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] litiliu commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
litiliu commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1212893409

   > I think we should also change our frontend from in this case, if user choose no auth we should hide the smtp information for it
   
   I agree with you, and i have created a frontend issure [https://github.com/apache/dolphinscheduler/issues/11455](url) for this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] codecov-commenter commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1171887096

   # [Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/10721?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#10721](https://codecov.io/gh/apache/dolphinscheduler/pull/10721?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (57b199b) into [dev](https://codecov.io/gh/apache/dolphinscheduler/commit/247ca4ae8a6d6e7a0580a999e04692a69f885144?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (247ca4a) will **decrease** coverage by `0.06%`.
   > The diff coverage is `76.00%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##                dev   #10721      +/-   ##
   ============================================
   - Coverage     40.89%   40.83%   -0.07%     
   + Complexity     4830     4827       -3     
   ============================================
     Files           897      897              
     Lines         36157    36131      -26     
     Branches       4006     3984      -22     
   ============================================
   - Hits          14788    14755      -33     
   - Misses        19898    19913      +15     
   + Partials       1471     1463       -8     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dolphinscheduler/pull/10721?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...olphinscheduler/plugin/alert/email/MailSender.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hbGVydC9kb2xwaGluc2NoZWR1bGVyLWFsZXJ0LXBsdWdpbnMvZG9scGhpbnNjaGVkdWxlci1hbGVydC1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9wbHVnaW4vYWxlcnQvZW1haWwvTWFpbFNlbmRlci5qYXZh) | `50.65% <73.91%> (-0.38%)` | :arrow_down: |
   | [...ugin/alert/email/template/DefaultHTMLTemplate.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hbGVydC9kb2xwaGluc2NoZWR1bGVyLWFsZXJ0LXBsdWdpbnMvZG9scGhpbnNjaGVkdWxlci1hbGVydC1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9wbHVnaW4vYWxlcnQvZW1haWwvdGVtcGxhdGUvRGVmYXVsdEhUTUxUZW1wbGF0ZS5qYXZh) | `82.97% <100.00%> (+0.75%)` | :arrow_up: |
   | [...che/dolphinscheduler/common/enums/CommandType.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvY29tbW9uL2VudW1zL0NvbW1hbmRUeXBlLmphdmE=) | `0.00% <0.00%> (-80.77%)` | :arrow_down: |
   | [...er/common/utils/placeholder/BusinessTimeUtils.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvY29tbW9uL3V0aWxzL3BsYWNlaG9sZGVyL0J1c2luZXNzVGltZVV0aWxzLmphdmE=) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [...er/api/service/impl/TaskGroupQueueServiceImpl.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvaW1wbC9UYXNrR3JvdXBRdWV1ZVNlcnZpY2VJbXBsLmphdmE=) | `54.54% <0.00%> (-15.16%)` | :arrow_down: |
   | [...eduler/api/service/impl/AlertGroupServiceImpl.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvaW1wbC9BbGVydEdyb3VwU2VydmljZUltcGwuamF2YQ==) | `82.52% <0.00%> (-6.02%)` | :arrow_down: |
   | [...er/server/builder/TaskExecutionContextBuilder.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL2J1aWxkZXIvVGFza0V4ZWN1dGlvbkNvbnRleHRCdWlsZGVyLmphdmE=) | `64.70% <0.00%> (-5.51%)` | :arrow_down: |
   | [...duler/api/service/impl/WorkerGroupServiceImpl.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvaW1wbC9Xb3JrZXJHcm91cFNlcnZpY2VJbXBsLmphdmE=) | `46.10% <0.00%> (-2.20%)` | :arrow_down: |
   | [...org/apache/dolphinscheduler/remote/utils/Host.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1yZW1vdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcmVtb3RlL3V0aWxzL0hvc3QuamF2YQ==) | `43.47% <0.00%> (-2.18%)` | :arrow_down: |
   | [...e/dolphinscheduler/remote/NettyRemotingClient.java](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1yZW1vdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcmVtb3RlL05ldHR5UmVtb3RpbmdDbGllbnQuamF2YQ==) | `51.38% <0.00%> (-1.39%)` | :arrow_down: |
   | ... and [29 more](https://codecov.io/gh/apache/dolphinscheduler/pull/10721/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/10721?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/10721?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [247ca4a...57b199b](https://codecov.io/gh/apache/dolphinscheduler/pull/10721?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1171890574

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10721)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL)
   
   [![71.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '71.4%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list) [71.4% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1190999038

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10721)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL)
   
   [![60.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '60.8%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list) [60.8% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911564349


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,47 @@
+package org.apache.dolphinscheduler.plugin.alert.email;

Review Comment:
   Missing licenses header.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] ruanwenjun commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911573922


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java:
##########
@@ -105,20 +105,29 @@ public MailSender(Map<String, String> config) {
 
         enableSmtpAuth = config.get(MailParamsConstants.NAME_MAIL_SMTP_AUTH);
 
-        mailUser = config.get(MailParamsConstants.NAME_MAIL_USER);
-        requireNonNull(mailUser, MailParamsConstants.NAME_MAIL_USER + mustNotNull);
+        if (Boolean.TRUE.toString().equalsIgnoreCase(enableSmtpAuth)) {

Review Comment:
   Yes, this is unsafe, but I think we can support this. In my knowledge, DS should directly use the email protocol to send mail, if the mail server/protocol support send/receive mail without password, then we also need to support this. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] litiliu commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
litiliu commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r922618471


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dolphinscheduler.plugin.alert.email;
+
+import org.apache.dolphinscheduler.alert.api.AlertConstants;
+import org.apache.dolphinscheduler.alert.api.ShowType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class MailSenderTest {
+
+    @Test
+    public void testEnableAuthConstructor() {
+        Map<String, String> enableAuthConfig = new HashMap<>();
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        enableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(enableAuthConfig);
+    }
+
+    @Test
+    public void testDisableAuthConstructor() {
+        Map<String, String> disableAuthConfig = new HashMap<>();
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "false");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        disableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(disableAuthConfig);
+    }

Review Comment:
   thanks for your suggestion. I have extract the params validation from the constructor to a new method. Please take a look again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] litiliu commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
litiliu commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911578336


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dolphinscheduler.plugin.alert.email;
+
+import org.apache.dolphinscheduler.alert.api.AlertConstants;
+import org.apache.dolphinscheduler.alert.api.ShowType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class MailSenderTest {
+
+    @Test
+    public void testEnableAuthConstructor() {
+        Map<String, String> enableAuthConfig = new HashMap<>();
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "347801120@qq.com");

Review Comment:
   good point, i have fixed it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
SbloodyS commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911706680


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dolphinscheduler.plugin.alert.email;
+
+import org.apache.dolphinscheduler.alert.api.AlertConstants;
+import org.apache.dolphinscheduler.alert.api.ShowType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class MailSenderTest {
+
+    @Test
+    public void testEnableAuthConstructor() {
+        Map<String, String> enableAuthConfig = new HashMap<>();
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        enableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(enableAuthConfig);
+    }
+
+    @Test
+    public void testDisableAuthConstructor() {
+        Map<String, String> disableAuthConfig = new HashMap<>();
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "false");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        disableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(disableAuthConfig);
+    }

Review Comment:
   Missing assert in test cases.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] caishunfeng commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
caishunfeng commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911576417


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dolphinscheduler.plugin.alert.email;
+
+import org.apache.dolphinscheduler.alert.api.AlertConstants;
+import org.apache.dolphinscheduler.alert.api.ShowType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class MailSenderTest {
+
+    @Test
+    public void testEnableAuthConstructor() {
+        Map<String, String> enableAuthConfig = new HashMap<>();
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "347801120@qq.com");

Review Comment:
   It is best not to add private information



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1191001350

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10721)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL)
   
   [![60.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '60.8%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list) [60.8% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1212898110

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10721)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL)
   
   [![60.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '60.8%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list) [60.8% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] zhongjiajie commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
zhongjiajie commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428

   I think we should also change our frontend from in this case, if user choose no auth we should hide the stmp information for it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] caishunfeng commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
caishunfeng commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1189933879

   Hi @litiliu please check the fail CI, I found that the checkstyle fail.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1171873681

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10721)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL)
   
   [![71.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '71.4%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list) [71.4% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] caishunfeng commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
caishunfeng commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911575745


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java:
##########
@@ -105,20 +105,29 @@ public MailSender(Map<String, String> config) {
 
         enableSmtpAuth = config.get(MailParamsConstants.NAME_MAIL_SMTP_AUTH);
 
-        mailUser = config.get(MailParamsConstants.NAME_MAIL_USER);
-        requireNonNull(mailUser, MailParamsConstants.NAME_MAIL_USER + mustNotNull);
+        if (Boolean.TRUE.toString().equalsIgnoreCase(enableSmtpAuth)) {

Review Comment:
   > Yes, this is unsafe, but I think we can support this. In my knowledge, DS should directly use the email protocol to send mail, if the mail server/protocol support send/receive mail without password, then we also need to support this.
   
   agree with @ruanwenjun :+1: 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1171890000

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=10721)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=10721&resolved=false&types=CODE_SMELL)
   
   [![71.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '71.4%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list) [71.4% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=10721&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] litiliu commented on a diff in pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
litiliu commented on code in PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#discussion_r911717272


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dolphinscheduler.plugin.alert.email;
+
+import org.apache.dolphinscheduler.alert.api.AlertConstants;
+import org.apache.dolphinscheduler.alert.api.ShowType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class MailSenderTest {
+
+    @Test
+    public void testEnableAuthConstructor() {
+        Map<String, String> enableAuthConfig = new HashMap<>();
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        enableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(enableAuthConfig);
+    }
+
+    @Test
+    public void testDisableAuthConstructor() {
+        Map<String, String> disableAuthConfig = new HashMap<>();
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "false");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        disableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(disableAuthConfig);
+    }

Review Comment:
   Yes, assert is missing.  I want to make sure that no exception will be thrown from that constructor with the given input param, if the exception is thrown then test case will fail.  I haven't figure out other method.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailSenderTest.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dolphinscheduler.plugin.alert.email;
+
+import org.apache.dolphinscheduler.alert.api.AlertConstants;
+import org.apache.dolphinscheduler.alert.api.ShowType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class MailSenderTest {
+
+    @Test
+    public void testEnableAuthConstructor() {
+        Map<String, String> enableAuthConfig = new HashMap<>();
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        enableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        enableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(enableAuthConfig);
+    }
+
+    @Test
+    public void testDisableAuthConstructor() {
+        Map<String, String> disableAuthConfig = new HashMap<>();
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "false");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "qq@qq.com");
+        disableAuthConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "qq@qq.com");
+        disableAuthConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
+        new MailSender(disableAuthConfig);
+    }

Review Comment:
   Yes, assert is missing.  I want to make sure that no exception will be thrown from that constructor with the given input param, if the exception is thrown then test case will fail.  I haven't figure out other method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] SbloodyS commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by GitBox <gi...@apache.org>.
SbloodyS commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1212897962

   > > I think we should also change our frontend from in this case, if user choose no auth we should hide the smtp information for it
   > 
   > I agree with you, and i have created a frontend issue #11455 for this.
   
   The frontend of the alarm plug-in can be implemented through the backend. You can take a look at `org.apache.dolphinscheduler.plugin.alert.email.EmailAlertChannelFactory`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] EricGao888 commented on pull request #10721: [fix-10698]fail to send email, when user don't enable smtp auth

Posted by "EricGao888 (via GitHub)" <gi...@apache.org>.
EricGao888 commented on PR #10721:
URL: https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1471589224

   Closed due to https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1471580085


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org