javax.net.ssl.SSLHandshakeException: No appropriate protocol

Hi,

I am trying to send an e-mail from a Docker container. I have tested this in Katalon Studio and sending e-mails is a breeze, I had no issues on my first try. Now, I am trying to do the same process through a Katalon Docker Image. What i have done is build my own image that extends the KDI since this has to run on AWS ECS. The thing is I am able to run the test, but when it is time to send the e-mail I get the following exception:

System is unable to email report. Reason: org.apache.commons.mail.EmailException: Sending the email to the following server failed : email-smtp.us-east-1.amazonaws.com:587
        at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
        at org.apache.commons.mail.Email.send(Email.java:1496)
        at com.kms.katalon.execution.util.MailUtil.sendSummaryMailForTestSuite(MailUtil.java:153)
        at com.kms.katalon.execution.launcher.ReportableLauncher.sendReportEmail(ReportableLauncher.java:336)
        at com.kms.katalon.execution.launcher.ReportableLauncher.sendReport(ReportableLauncher.java:296)
        at com.kms.katalon.execution.launcher.ReportableLauncher.preExecutionComplete(ReportableLauncher.java:162)
        at com.kms.katalon.execution.launcher.ProcessLauncher.onWatchdogComplete(ProcessLauncher.java:194)
        at com.kms.katalon.execution.launcher.LaunchWatchdog.notifyProcessTerminated(LaunchWatchdog.java:136)
        at com.kms.katalon.execution.launcher.LaunchWatchdog.run(LaunchWatchdog.java:66)
        at java.lang.Thread.run(Thread.java:748)
Caused by: javax.mail.MessagingException: Can't send command to SMTP host;
  nested exception is:
        javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
        at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1420)
        at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1408)
        at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:847)
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:384)
        at javax.mail.Service.connect(Service.java:297)
        at javax.mail.Service.connect(Service.java:156)
        at javax.mail.Service.connect(Service.java:105)
        at javax.mail.Transport.send0(Transport.java:168)
        at javax.mail.Transport.send(Transport.java:98)
        at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
        ... 9 more
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
        at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171)
        at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:98)
        at sun.security.ssl.TransportContext.kickstart(TransportContext.java:220)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:428)
        at sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:804)
        at sun.security.ssl.SSLSocketImpl.access$200(SSLSocketImpl.java:73)
        at sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1166)
        at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:101)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
        at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1418)
        ... 18 more

When I checked the e-mail settings of the project (in Katalon Studio) I know for a fact that everything is where it should be, authentication data is being encrypted, username and password are correct, and protocol is TLS (as it should be). So I don’t understand. I did some browsing and I believe this has something to do with the fact that it is a Docker image, but I can’t find the solution to my problem.

My machine is a MacBook Pro running macOS 12.1 (Monterey) and it has postfix installed (which was one of the many recommendations I saw). I tried to install sendmail with apt-get install -y sendmail in the container but that failed. I would like for the container to use the host to send mail, but I am having a hard time figuring out how to do that.

Any help would be greatly appreciated.
Thanks!

did you manage to figure out the solution ? am facing it right now :confused:

Hi there, we are asking for internal support for this issue, we will get back to you with more details. Thank you.

@nk1 Yes. Since I was running from a Docker image, the KDI does not have the capacity to send e-mails. To achieve this, I had to run another docker image for SMTP (I used bytemark/smtp). On the email settings of the test project, I made the host point to the new SMTP docker container which I had running in a Docker Compose. To run in ECS, you can’t run a normal docker compose. While I did use the uploaded images to ECR of both the katalon build (with my test project) and the SMTP server, I had to configure it the Amazon ECR way.

1 Like