[GH-ISSUE #264] self-signed certificate error when attempting to send an email #3308

Closed
opened 2026-04-20 07:14:25 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @Nightreaper77 on GitHub (Mar 2, 2025).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/264

When attempting to send an email after configuring SMTP, I am getting the following error:

2025-02-22T22:27:34.217Z [error]: self-signed certificate
Stack: Error: self-signed certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1677:34)
    at TLSSocket.emit (node:events:518:28)
    at TLSSocket._finishInit (node:_tls_wrap:1076:8)
    at ssl.onhandshakedone (node:_tls_wrap:862:12)
    at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {"code":"ESOCKET","command":"CONN"}

I'm using ProtonMail Bridge as my SMTP server (unofficial docker container here: shenxn/protonmail-bridge-docker)

Relatively confident that the SMTP server is setup correctly, as I'm using the same configuration for other services like Nextcloud and they are working fine.

Here's my smtp configuration from config/config.yml:

email:
    smtp_host: "ip_address"
    smtp_port: 1025
    smtp_user: "username"
    smtp_pass: "password"
    no_reply: "email(same as username)"
    smtp_secure: false

ProtonMail Bridge is meant to use STARTTLS, which is normally configured as insecure, but I did try smtp_secure as well and got a TLS version mismatch (as expected).

Since it's a self-signed cert error, I imagine a config option could be added to ignore certificate warnings, but not sure.

Originally created by @Nightreaper77 on GitHub (Mar 2, 2025). Original GitHub issue: https://github.com/fosrl/pangolin/issues/264 When attempting to send an email after configuring SMTP, I am getting the following error: ``` 2025-02-22T22:27:34.217Z [error]: self-signed certificate Stack: Error: self-signed certificate at TLSSocket.onConnectSecure (node:_tls_wrap:1677:34) at TLSSocket.emit (node:events:518:28) at TLSSocket._finishInit (node:_tls_wrap:1076:8) at ssl.onhandshakedone (node:_tls_wrap:862:12) at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {"code":"ESOCKET","command":"CONN"} ``` I'm using ProtonMail Bridge as my SMTP server (unofficial docker container here: shenxn/protonmail-bridge-docker) Relatively confident that the SMTP server is setup correctly, as I'm using the same configuration for other services like Nextcloud and they are working fine. Here's my smtp configuration from config/config.yml: ``` email: smtp_host: "ip_address" smtp_port: 1025 smtp_user: "username" smtp_pass: "password" no_reply: "email(same as username)" smtp_secure: false ``` ProtonMail Bridge is meant to use STARTTLS, which is normally configured as insecure, but I did try smtp_secure as well and got a TLS version mismatch (as expected). Since it's a self-signed cert error, I imagine a config option could be added to ignore certificate warnings, but not sure.
Author
Owner

@miloschwartz commented on GitHub (Mar 3, 2025):

We use Nodemailer under the hood to send emails. I found this article that shows the following in the config.

tls: {
  rejectUnauthorized: false
}

Wondering if you think this would do the trick? I can expose this via the config file for you to test in the next release.

<!-- gh-comment-id:2693007897 --> @miloschwartz commented on GitHub (Mar 3, 2025): We use Nodemailer under the hood to send emails. I found [this article](https://dev.to/polluterofminds/how-to-use-protonmail-with-nodemailer-5c4l) that shows the following in the config. ```typescript tls: { rejectUnauthorized: false } ``` Wondering if you think this would do the trick? I can expose this via the config file for you to test in the next release.
Author
Owner

@Nightreaper77 commented on GitHub (Mar 3, 2025):

Yeah that definitely looks like the correct option. I'll test on next release. Thanks for the quick reply!

<!-- gh-comment-id:2693022890 --> @Nightreaper77 commented on GitHub (Mar 3, 2025): Yeah that definitely looks like the correct option. I'll test on next release. Thanks for the quick reply!
Author
Owner

@Nightreaper77 commented on GitHub (Mar 3, 2025):

Built from dev branch and confirmed that it does indeed fix the issue. Thanks!

<!-- gh-comment-id:2693224020 --> @Nightreaper77 commented on GitHub (Mar 3, 2025): Built from dev branch and confirmed that it does indeed fix the issue. Thanks!
Author
Owner

@miloschwartz commented on GitHub (Mar 3, 2025):

Awesome! Just fixed the typo in the config variable name.

<!-- gh-comment-id:2693245262 --> @miloschwartz commented on GitHub (Mar 3, 2025): Awesome! Just fixed the typo in the config variable name.
Author
Owner

@reg98643t commented on GitHub (Jul 7, 2025):

Sorry to resurrect this thread, but what do I put in my config.yml to make this work? I have the same issue with PM Bridge.

Edit: nevermind, if anyone stumbles on this it's

smtp_tls_reject_unauthorized: false

<!-- gh-comment-id:3046734976 --> @reg98643t commented on GitHub (Jul 7, 2025): Sorry to resurrect this thread, but what do I put in my config.yml to make this work? I have the same issue with PM Bridge. Edit: nevermind, if anyone stumbles on this it's > smtp_tls_reject_unauthorized: false
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#3308