Could not connect to SMTP host when testing

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Opensearch Version 2.11.1

Describe the issue:
I have configured alerting and notification on my Opensearch cluster but whenever I test the notification, it errors out. On the Opensearch dashboard I see {“statusCode”:424,“error”:“Failed Dependency”,“message”:“unknown error”}.

On the pod logs I see:
{“status_code”:“424”,“status_text”:“sendEmail Error, status:Could not convert socket to TLS”}

I have configured the STMP sender (analytics) with the correct custom smtp host and port 587 with encryption: STARTTLS. I know this custom smtp host works because it works in a separate java spring boot api.

Please let me know if there is something I may be missing. I can also provide additional information if I missed anything in my initial description. Thanks

Configuration:

I ran the keystore cli to add it to all pods and restarted cluster
opensearch.notifications.core.email.analytics.username
opensearch.notifications.core.email.analytics.password

Relevant Logs or Screenshots:

1 Like

Hi @ic1000

Have you tried to use SSL/TLS instead of STARTTLS ?

@Eugene7
Hi yes I have, when switched to SSL/TLS i see this error message: statusCode=424, statusText=sendEmail Error, status:Could not connect to SMTP host

Please ensure that TLS configuration is compatible with the SMTP server.

Hi @ic1000 ,

In order to check whether the SMTP server is reachable, please execute from the OpenSearch server the following command:

curl --ssl-reqd \
  --url 'smtps://mail.example.com:465' \
  --user 'username@example.com:password' \
  --mail-from 'myself@example.com' \
  --mail-rcpt 'receiver@example.com' \
  --upload-file mail.txt

An example mail.txt could look like this:

From: John Smith <john@example.com>
To: Joe Smith <smith@example.com>
Subject: an example.com example email
Date: Mon, 7 Nov 2016 08:45:16

Dear Joe,
Welcome to this example email. 

Hi @ic1000 or others,

I am quite new in the Opensearch world.
Could you please provide me with the full procedure for how to set up the mailing notification?
I have filled the mailing section but it is missing the credentials thus fails to send the email.

Thanks in advance, Yehuda

Must ensure that the TLS/SSL setting are correctly configured for the SMTP connection. Also check there is no firewall is blocking the connection from the openssh server to SMTP server on a specified port.