[ https://issues.apache.org/jira/browse/FINERACT-1070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17250886#comment-17250886 ]
Francis Guchie edited comment on FINERACT-1070 at 12/17/20, 8:16 AM: --------------------------------------------------------------------- [~vorburger] below is how i configure the ssmtp.config file o my Ubuntu linux box for the ports 465 and 587 respectively *BASIC CONFIG FOR Port 465* root=u...@gmail.com mailhub=smtp.gmail.com:465 AuthUser=u...@gmail.com AuthPass=passwordforUser@gmail UseTLS=YES *##add this for port 587 but remove it if using port 465* *### UseSTARTTLS=YES** rewriteDomain=gmail.com hostname=full.domain.name FromLineOverride=YES *BASIC CONFIG FOR Port 587* root=u...@gmail.com mailhub=smtp.gmail.com:465 AuthUser=u...@gmail.com AuthPass=passwordforUser@gmail UseTLS=YES *##add this below for port 587 but comment it out if using port 465** *UseSTARTTLS=YES* rewriteDomain=gmail.com hostname=full.domain.name FromLineOverride=YES in my view both Ports need UseTLS = YES to work and a number of servers and VPS providers have blocked the use of Port 25 (*it has been widely misused*) as i read from [https://blog.mailchannels.com/port-25-why-keeping-it-open-is-important#:~:text=For%20more%20than%20a%20decade,send%20huge%20amounts%20of%20spam.] Port 587 to work one has to set *UseSTARTTLS=YES* yet if you set the same for port 465 mail will not go (testing from the linux box using the echo command below) *echo -e 'Subject: test\n\nTesting ssmtp configs for 465 n 587' | sendmail -v [u...@gmail.com|mailto:u...@gmail.com]* So i think the condition in the file should be a nested if condition if (UseTLS = true) { if (using port 465 ) { set *UseSTARTTLS=NO} * if (using port 587) [set *UseSTARTTLS=YES]* } I found the lines below by reading around on the internet *SSL/TLS (Port 465) -> email.setSSLOnConnect(true);* Email email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); #email.setSSLOnConnect(true); *NOT RECOMMENDED* email.setFrom("u...@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :)"); email.addTo("f...@bar.com"); email.send(); *STARTTLS (Port 587) -> email.setStartTLSEnabled(true);* Email email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(587); email.setAuthenticator(new DefaultAuthenticator("username", "password")); NOT RECOMMENDED email.setStartTLSEnabled(true); email.setFrom("u...@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :)"); email.addTo("f...@bar.com"); email.send(); I am thinking we restrict ourselves to ports 465 and 587 and avoid the rest due to complications was (Author: francisguchie): [~vorburger] below is how i configure the ssmtp.config file o my Ubuntu linux box for the ports 465 and 587 respectively *BASIC CONFIG FOR Port 465* root=u...@gmail.com mailhub=smtp.gmail.com:465 AuthUser=u...@gmail.com AuthPass=passwordforUser@gmail UseTLS=YES *##add this for port 587 but remove it if using port 465* UseSTARTTLS=YES* rewriteDomain=gmail.com hostname=full.domain.name FromLineOverride=YES *BASIC CONFIG FOR Port 587* root=u...@gmail.com mailhub=smtp.gmail.com:465 AuthUser=u...@gmail.com AuthPass=passwordforUser@gmail UseTLS=YES *##add this below for port 587 but comment it out if using port 465** *UseSTARTTLS=YES* rewriteDomain=gmail.com hostname=full.domain.name FromLineOverride=YES in my view both Ports need UseTLS = YES to work and a number of servers and VPS providers have blocked the use of Port 25 (*it has been widely misused*) as i read from [https://blog.mailchannels.com/port-25-why-keeping-it-open-is-important#:~:text=For%20more%20than%20a%20decade,send%20huge%20amounts%20of%20spam.] Port 587 to work one has to set *UseSTARTTLS=YES* yet if you set the same for port 465 mail will not go (testing from the linux box using the echo command below) *echo -e 'Subject: test\n\nTesting ssmtp configs for 465 n 587' | sendmail -v [u...@gmail.com|mailto:u...@gmail.com]* So i think the condition in the file should be a nested if condition if (UseTLS = true) { if (using port 465 ) { set *UseSTARTTLS=NO} * if (using port 587) [set *UseSTARTTLS=YES]* } I found the lines below by reading around on the internet *SSL/TLS (Port 465) -> email.setSSLOnConnect(true);* Email email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("username", "password")); #email.setSSLOnConnect(true); *NOT RECOMMENDED* email.setFrom("u...@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :)"); email.addTo("f...@bar.com"); email.send(); *STARTTLS (Port 587) -> email.setStartTLSEnabled(true);* Email email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(587); email.setAuthenticator(new DefaultAuthenticator("username", "password")); NOT RECOMMENDED email.setStartTLSEnabled(true); email.setFrom("u...@gmail.com"); email.setSubject("TestMail"); email.setMsg("This is a test mail ... :)"); email.addTo("f...@bar.com"); email.send(); I am thinking we restrict ourselves to ports 465 and 587 and avoid the rest due to complications > Email Service Configurations defaults to port 25 irrespective of Port number > specified > -------------------------------------------------------------------------------------- > > Key: FINERACT-1070 > URL: https://issues.apache.org/jira/browse/FINERACT-1070 > Project: Apache Fineract > Issue Type: Bug > Components: User Management > Affects Versions: 1.4.0 > Reporter: Francis Guchie > Assignee: Michael Vorburger > Priority: Critical > Fix For: 1.5.0 > > Attachments: email Service Configurations.png, > image-2020-10-15-11-17-57-324.png, image-2020-12-02-11-56-01-572.png, > image-2020-12-12-17-36-26-558.png > > > Even if use sets the following, MifosX will not send emails > 1- Configure the server on which mifos is installed to be able to send Emails > - One can do this by installing sSMTP on the server and testing email sending > on the command line > 2- if using a gmail address only ports 465 and 587 will work because port 25 > is by default disabled on google servers This includes very many other VPS / > Mail servers > 3- Configure the port under the Email External Services Configuration > one will still get the error below > 03-Jul-2020 19:59:41.251 SEVERE [https-jsse-nio-443-exec-18] > com.sun.jersey.spi.container.ContainerResponse.mapMappableContainerException > The RuntimeException could not be mapped to a response, re-throwing to the > HTTP container > > org.apache.fineract.infrastructure.core.service.PlatformEmailSendException: > org.apache.commons.mail.EmailException: > Sending the email to the following server failed : smtp.gmail.com:25 > at > org.apache.fineract.infrastructure.core.service.GmailBackedPlatformEmailService.sendDefinedEmail(GmailBackedPlatformEmailService.java:81) -- This message was sent by Atlassian Jira (v8.3.4#803005)