#Mail - Bad Request Could not convert socket to TLS

1 messages · Page 1 of 1 (latest)

thorn eagle
#

When testing the mail connection, I get the error "Bad Request: Could not convert socket to TLS"

I have an SMTP server with no authentication. It only responds to requests with a specific IP, so Appsmith is able to access it. Other services on the sever can access the SMTP host without any issues.

  • SMTP host is valid (works with other services)
  • port is default (25)
  • from-address works with other services
  • to-addresses is valid
  • TLS disabled

Any idea what causes this?

The same issue was discussed here, but the solution back then was to disable Authentication in general. I need Authentication though.
#1030348302148968559 message

fervent kayakBOT
#

Hi There!
Could you please share some more info?

  • Which version of Appsmith are you on?
  • Can you please tell me which email service you use?
thorn eagle
#

Appsmith v1.8.6
Microsoft Exchange

fervent kayakBOT
fervent kayakBOT
#

Hey! @thorn eagle Can you please try changing the port to 587, as
mentioned here? -
https://community.appsmith.com/t/how-do-i-configure-gmail-smtp-with-appsmith/52/2

Appsmith

Here’s a sample configuration as a starting point: # ***** Email ********** APPSMITH_MAIL_ENABLED=true [email protected] [email protected] APPSMITH_MAIL_HOST=smtp.gmail.com APPSMITH_MAIL_PORT=587 # ***** Set to true if providing a TLS port ****** APPSMITH_MAIL_SMTP_TLS_ENABLED=true [email protected]...

thorn eagle
fervent kayakBOT
#

Hi! Do you still face issues with this?

fervent kayakBOT
#

Hey! We took our time, didn't we? 😬

But I think we have two workarounds for this issue -

Workaround from Admin Settings page: On the Admin settings page, go to email
configurations, disable the TLS from the current state, and save&restart. After
that, once appsmith is up, enable the TLS again, provide credentials, and
save&restart. It should work now.

Config Workaround: Go and manually set APPSMITH_MAIL_SMTP_TLS_ENABLED=true in
the docker.env file & restart, in case you have enabled TLS & it's not working

We expect the proper fix to be out by next week.

thorn eagle
#

Sry that it took me so long...

Here are the logs:
backend stdout | DEBUG: successfully loaded resource: jar:file:/opt/appsmith/backend/server.jar!/BOOT-INF/lib/jakarta.mail-1.0.0.jar!/META-INF/javamail.address.map
DEBUG: getProvider() returning jakarta.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.eu1.1corp.org", port 25, isSSL false
220 .com Microsoft ESMTP MAIL Service ready at Thu, 20 Apr 2023 17:08:22 +0100
DEBUG SMTP: connected to host "smtp.eu1.1corp.org", port: 25
EHLO mosaic-appsmith-0.mosaic-appsmith.csg-ma.svc.cluster.local
250-
.com Hello [10.32.0.53]
250-SIZE 52428800
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250 XSHADOW
DEBUG SMTP: Found extension "SIZE", arg "52428800"
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "XEXCH50", arg ""
DEBUG SMTP: Found extension "XSHADOW", arg ""
STARTTLS
220 2.0.0 SMTP server ready
[2023-04-20 15:39:59,712] userEmail=*******@*****.com, sessionId=f0ba5113-3329-459c-91ee-9e263d29cfd1, thread=nioEventLoopGroup-3-4, requestId=29d020e3-d963-4388-99a0-3e8baad614d5 -
com.appsmith.server.exceptions.AppsmithException: Bad Request: Could not convert socket to TLS

#

So the connection to the sever works. I used port 25 and I have TLS disabled in the GUI. The server does not require username and password but rather checks the IP address.

thorn eagle
fervent kayakBOT
#

We have an open issue on our GitHub for this here. Another user had the same
problem, and fixed it by changing the SMTP server to Office365 and using auth.
Could this work for you too?

Other thread:
https://discord.com/channels/725602949748752515/1070690472319782922

Issue:
https://github.com/appsmithorg/appsmith/issues/20884
[https://github.com/appsmithorg/appsmith/issues/20884]

GitHub

Is there an existing issue for this? I have searched the existing issues Description When starting a server that has TLS disabled in the config, it will attempt STARTTLS anyway. I expect the server...

GitHub

Framework to build admin panels, internal tools, and dashboards. Integrates with 15+ databases and any API. - Issues · appsmithorg/appsmith

thorn eagle
#

Unfortunately not 😦 I only have the smtp sever.

To rule out a few things:

  • TLS 1.2 is fine?
  • is starttls "True" by default?
  • Is there a way to set mail.smtp.starttls.enable" to "false"?
fervent kayakBOT
#

We've asked the team about this. In the meantime, can you tell us what version
of Appsmith you are on?

fervent kayakBOT
#

Could you please let us know what Appsmith version you are using and also send
us more logs. There should be some relevant logs just above the ones you sent
us. Please send us 100 lines above this snippet too.

thorn eagle
fervent kayakBOT
#

The rows before the ones you sent in the file: backend stdout | 220 2.0.0 SMTP server ready

thorn eagle
thorn eagle
#

A few thoughts that we had:

  • Jakarta Mail settings could not have properly disabled TLS. We might need a line like properties.put("mail.smtp.starttls.enable", "false"). Is it possible to set that variable in the configs somehow as a quick fix?
  • Jakarta Mail 1.0.0 seems quite old, maybe a later version would be better?
  • Maybe we can get more logs in some debug mode?
fervent kayakBOT
#

Hi there!
Your Email server does not support STARTTLS; therefore, it won’t work in
Appsmith due to this bug - https://github.com/appsmithorg/appsmith/issues/20884
Could you disable STARTTLS in the list of extensions from their SMTP server?

GitHub

Is there an existing issue for this? I have searched the existing issues Description When starting a server that has TLS disabled in the config, it will attempt STARTTLS anyway. I expect the server...

thorn eagle