This is an automated email from the ASF dual-hosted git repository.

ptuomola pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new f0d4f5e  add starttls and factory
f0d4f5e is described below

commit f0d4f5e332a9ef643a47403db2023b561524ca86
Author: francisguchie <[email protected]>
AuthorDate: Tue Aug 24 13:09:33 2021 +0000

    add starttls and factory
---
 .../core/service/GmailBackedPlatformEmailService.java    | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/GmailBackedPlatformEmailService.java
 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/GmailBackedPlatformEmailService.java
index 3183550..c795c66 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/GmailBackedPlatformEmailService.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/GmailBackedPlatformEmailService.java
@@ -73,15 +73,15 @@ public class GmailBackedPlatformEmailService implements 
PlatformEmailService {
         props.put("mail.smtp.auth", "true");
         props.put("mail.debug", "true");
 
-        try {
-            if (smtpCredentialsData.isUseTLS()) {
-                // Needs to disable startTLS if the port is 465 in order to 
send the email successfully when using the
-                // smtp.gmail.com as the host
-                if (smtpCredentialsData.getPort().equals("465")) {
-                    props.put("mail.smtp.starttls.enable", "false");
-                }
-            }
+        // these are the added lines
+        props.put("mail.smtp.starttls.enable", "true");
+        // props.put("mail.smtp.ssl.enable", "true");
+
+        props.put("mail.smtp.socketFactory.port", 
Integer.parseInt(smtpCredentialsData.getPort()));
+        props.put("mail.smtp.socketFactory.class", 
"javax.net.ssl.SSLSocketFactory");
+        props.put("mail.smtp.socketFactory.fallback", "true");
 
+        try {
             SimpleMailMessage message = new SimpleMailMessage();
             message.setFrom(smtpCredentialsData.getFromEmail()); // same email 
address used for the authentication
             message.setTo(emailDetails.getAddress());

Reply via email to