From 92396cd7dba35cfcca8f5c70c127770c7f3e9d0c Mon Sep 17 00:00:00 2001 From: tabrez-fiter Date: Mon, 9 Dec 2024 15:27:14 +0800 Subject: [PATCH 1/2] SU-470 : Mail Configuration - Remove authentification --- .../org/apache/fineract/gradle/service/EmailService.groovy | 6 ++++-- .../ally/service/CompensationAlertEmailServiceImpl.java | 7 +------ .../email/service/EmailMessageJobEmailServiceImpl.java | 2 +- .../service/ReportMailingJobEmailServiceImpl.java | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/buildSrc/src/main/groovy/org/apache/fineract/gradle/service/EmailService.groovy b/buildSrc/src/main/groovy/org/apache/fineract/gradle/service/EmailService.groovy index 1274f33f72..33bf81b8e5 100644 --- a/buildSrc/src/main/groovy/org/apache/fineract/gradle/service/EmailService.groovy +++ b/buildSrc/src/main/groovy/org/apache/fineract/gradle/service/EmailService.groovy @@ -43,12 +43,14 @@ class EmailService { this.properties.put("mail.smtp.auth", "false") this.properties.put("mail.smtp.starttls.enable", config.tls.toString()) if(config.ssl) { - this.properties.put("mail.smtp.port", "465") + this.properties.put("mail.smtp.`port", "465") this.properties.put("mail.smtp.socketFactory.port", "465"); this.properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); - } else { + } else if (config.tls) { this.properties.put("mail.smtp.port", "587") + } else { + this.properties.put("mail.smtp.port", "25") } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/custom/portfolio/ally/service/CompensationAlertEmailServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/custom/portfolio/ally/service/CompensationAlertEmailServiceImpl.java index ced96eae7b..10d3dc4072 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/custom/portfolio/ally/service/CompensationAlertEmailServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/custom/portfolio/ally/service/CompensationAlertEmailServiceImpl.java @@ -52,15 +52,10 @@ public void sendCompensationAlertEmail(String to, String subject, String body) { private Properties getJavaMailProperties(SMTPCredentialsData smtpCredentialsData) { Properties properties = new Properties(); - properties.put("mail.smtp.starttls.enable", "true"); + properties.put("mail.smtp.starttls.enable", "false"); properties.put("mail.transport.protocol", "smtp"); properties.put("mail.smtp.auth", "false"); properties.put("mail.smtp.ssl.trust", smtpCredentialsData.getHost()); - if (smtpCredentialsData.isUseTLS()) { - if (smtpCredentialsData.getPort().equals("465")) { - properties.put("mail.smtp.starttls.enable", "false"); - } - } return properties; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailMessageJobEmailServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailMessageJobEmailServiceImpl.java index 300807d499..f3a280d7ca 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailMessageJobEmailServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailMessageJobEmailServiceImpl.java @@ -84,7 +84,7 @@ public void sendEmailWithAttachment(EmailMessageWithAttachmentData emailMessageW } private Properties getJavaMailProperties(SMTPCredentialsData smtpCredentialsData, Properties properties) { - properties.put("mail.smtp.starttls.enable", "true"); + properties.put("mail.smtp.starttls.enable", "false"); properties.put("mail.transport.protocol", "smtp"); properties.put("mail.smtp.auth", "false"); properties.put("mail.smtp.ssl.trust", smtpCredentialsData.getHost()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/service/ReportMailingJobEmailServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/service/ReportMailingJobEmailServiceImpl.java index f7380b1926..063ad0ca98 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/service/ReportMailingJobEmailServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/service/ReportMailingJobEmailServiceImpl.java @@ -92,7 +92,7 @@ private Properties getJavaMailProperties(Collection Date: Mon, 9 Dec 2024 17:07:49 +0800 Subject: [PATCH 2/2] SU-470 : Mail Configuration - Remove authentification --- .../org/apache/fineract/gradle/service/EmailService.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/apache/fineract/gradle/service/EmailService.groovy b/buildSrc/src/main/groovy/org/apache/fineract/gradle/service/EmailService.groovy index 33bf81b8e5..9f2138af64 100644 --- a/buildSrc/src/main/groovy/org/apache/fineract/gradle/service/EmailService.groovy +++ b/buildSrc/src/main/groovy/org/apache/fineract/gradle/service/EmailService.groovy @@ -43,7 +43,7 @@ class EmailService { this.properties.put("mail.smtp.auth", "false") this.properties.put("mail.smtp.starttls.enable", config.tls.toString()) if(config.ssl) { - this.properties.put("mail.smtp.`port", "465") + this.properties.put("mail.smtp.port", "465") this.properties.put("mail.smtp.socketFactory.port", "465"); this.properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");