# Notification channels - send test mail - certificate not found

**URL:** <https://forum.opensearch.org/t/notification-channels-send-test-mail-certificate-not-found/20035>\
**Category:** Alerting\
**Created:** [June 27, 2024, 1:49pm UTC](https://forum.opensearch.org/t/notification-channels-send-test-mail-certificate-not-found/20035 "2024-06-27T13:49:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seeruebe](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@seeruebe](https://forum.opensearch.org/u/seeruebe)\
**Post date:** [June 27, 2024, 1:49pm UTC](https://forum.opensearch.org/t/notification-channels-send-test-mail-certificate-not-found/20035/1 "2024-06-27T13:49:37Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser): v 2.13.0/Kubernetes/Firefox

**Describe the issue** :  
We are not able to send mails via STARTTLS because the certificate is not found (unable to find valid certification path to requested target). I added the missing certificate to the cacerts keystore, and tried to send mails with another java program using the same libs. This works once the correct certificate is provided in the cacerts keystore. However it doesn’t from Opensearch:

I added the certificate by `keytool -cacerts -import -file mycert.pem`, which added the certificate to keystore $JAVA\_HOME/lib/security/cacerts. What cacerts keystore is used by opensearch for mail sending?

**Configuration** :

**Relevant Logs or Screenshots** :

```auto
[2024-06-27T13:04:39,817][INFO][o.o.n.c.c.DestinationSmtpClient] [pc-logging-master-0] EmailException javax.mail.MessagingException: Could not convert socket to TLS;
  nested exception is:
	javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: **unable to find valid certification path to requested target**
[2024-06-27T13:04:39,817][INFO][o.o.n.s.SendMessageActionHelper] [pc-logging-master-0] notifications:sendMessage:statusCode=424, statusText=sendEmail Error, status:Could not convert socket to TLS
[2024-06-27T13:04:39,817][INFO][o.o.n.s.SendMessageActionHelper] [pc-logging-master-0] notifications:CjspgI8BYWKGlDAc9PEH:statusCode=424, statusText=sendEmail Error, status:Could not convert socket to TLS
[2024-06-27T13:04:39,818][WARN][o.o.n.a.PluginBaseAction] [pc-logging-master-0] notifications:OpenSearchStatusException:
org.opensearch.OpenSearchStatusException: {"event_status_list": [{"config_id":"JOKROpABG9lzXzS8Ztip","config_type":"email","config_name":"stephan","email_recipient_status":[{"recipient":"stephan.name@example.com","delivery_status":{"status_code":"424","status_text":"sendEmail Error, status:Could not convert socket to TLS"}}],"delivery_status":{"status_code":"424","status_text":"sendEmail Error, status:Could not convert socket to TLS"}}]}
	at org.opensearch.notifications.send.SendMessageActionHelper.executeRequest(SendMessageActionHelper.kt:101) ~[?:?]
	at org.opensearch.notifications.send.SendMessageActionHelper$executeRequest$1.invokeSuspend(SendMessageActionHelper.kt) ~[?:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.8.21.jar:1.8.21-release-380(1.8.21)]
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32) [kotlinx-coroutines-core-jvm-1.4.3.jar:?]
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:113) [kotlinx-coroutines-core-jvm-1.4.3.jar:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) [kotlin-stdlib-1.8.21.jar:1.8.21-release-380(1.8.21)]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [kotlinx-coroutines-core-jvm-1.4.3.jar:?]
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) [kotlinx-coroutines-core-jvm-1.4.3.jar:?]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) [kotlinx-coroutines-core-jvm-1.4.3.jar:?]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) [kotlinx-coroutines-core-jvm-1.4.3.jar:?]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) [kotlinx-coroutines-core-jvm-1.4.3.jar:?]
[2024-06-27T13:04:39,819][ERROR][o.o.n.a.SendTestNotificationAction] [pc-logging-master-0] notifications:SendTestNotificationAction-send Error:OpenSearchStatusException[{"event_status_list": [{"config_id":"JOKROpABG9lzXzS8Ztip","config_type":"email","config_name":"stephan","email_recipient_status":[{"recipient":"stephan.name@example.com","delivery_status":{"status_code":"424","status_text":"sendEmail Error, status:Could not convert socket to TLS"}}],"delivery_status":{"status_code":"424","status_text":"sendEmail Error, status:Could not convert socket to TLS"}}]}]

```

---

<div class="post-metadata">

**Author:** ![Eugene7](https://avatars.discourse-cdn.com/v4/letter/e/bbce88/32.png) [@Eugene7](https://forum.opensearch.org/u/Eugene7)\
**Post date:** [July 12, 2024, 1:55pm UTC](https://forum.opensearch.org/t/notification-channels-send-test-mail-certificate-not-found/20035/2 "2024-07-12T13:55:29Z")

</div>

> [@seeruebe](#):
>
> `sendEmail Error, status:Could not convert socket to TLS`

Hi @seeruebe ,

In order to configure the SMTP sender for STARTTLS , you need to add an email address, host, and port number. I have attached the screenshot below.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/b/b3078933c914e6d4c7dc9ce44928ecae6da4ddd9.png)

Have you added your sender account as per the documentation below?

> **[Notifications](https://opensearch.org/docs/latest/observing-your-data/notifications/index/#authenticate-sender-account)**
>
> Notifications

---

<div class="post-metadata">

**Author:** ![seeruebe](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@seeruebe](https://forum.opensearch.org/u/seeruebe)\
**Post date:** [August 9, 2024, 1:38pm UTC](https://forum.opensearch.org/t/notification-channels-send-test-mail-certificate-not-found/20035/3 "2024-08-09T13:38:27Z")

</div>

Hi @Eugene7 , thanks for your response. But there is befor another exception:

```auto
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: **unable to find valid certification path to requested target**

```

I’m afraid this is actually the issue. How could it work w/o a valid certificate?

To answer your question. Yes, I added the sender account.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [October 8, 2024, 1:38pm UTC](https://forum.opensearch.org/t/notification-channels-send-test-mail-certificate-not-found/20035/4 "2024-10-08T13:38:50Z")

</div>

Closed on October 8, 2024, 1:38pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
