Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error sending email Error: self-signed certificate #795

Open
facorazza opened this issue Aug 1, 2023 · 5 comments
Open

Error sending email Error: self-signed certificate #795

facorazza opened this issue Aug 1, 2023 · 5 comments

Comments

@facorazza
Copy link

Describe the bug

Rallly doesn't seem to support SMTP mail servers with a self-signed certificate.

efed770825b0 Error sending email Error: self-signed certificate
efed770825b0     at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34)
efed770825b0     at TLSSocket.emit (node:events:513:28)
efed770825b0     at TLSSocket.emit (node:domain:552:15)
efed770825b0     at TLSSocket._finishInit (node:_tls_wrap:959:8)
efed770825b0     at ssl.onhandshakedone (node:_tls_wrap:743:12)
efed770825b0     at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
efed770825b0   code: 'ESOCKET',
efed770825b0   command: 'CONN'
efed770825b0 }

I believe the code related to this is here. The behaviour is the same whether SMTP_TLS_ENABLED is set to true or false.

I'm not fluent in TypeScript but perhaps this could help.

To Reproduce
Steps to reproduce the behavior:

  1. Set up SMTP with self-signed certificate
  2. Try to send an email

Expected behavior
Email sent to the mail server with a self-signed certificate.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser: Firefox
  • Version: 115
@lukevella
Copy link
Owner

Hi, setting rejectUnauthorized to false is intended to allow self-signed certificates so in theory it should work as long as you use SMTP_TLS_ENABLED is true.

If that's not working, perhaps the additional ciphers parameter is causing some sort of issue? Or could be an upstream issue nodemailer and we just need to update the package.

@lukevella lukevella added 🥹 help wanted ✅ good first issue Feel free to pick this up labels Aug 1, 2023
@lukevella
Copy link
Owner

I don't have the time to look into this I'm afraid but if someone wants to test whether sending emails through an SMTP server with TLS and a self-signed certificate actually works or test whether the two possible solutions above fixes the issue that would be a welcome PR.

@michnovka
Copy link

Hi, this issue is important for me also, since from recent update user registration seems required. I cannot seem to bypass this even when using SMTP_TLS_ENABLED=false or SMTP_SECURE=false

@michnovka
Copy link

michnovka commented Apr 4, 2024

Getting also this error when trying to use our self-signed cert on port 587:

rallly-1     | Error sending email [Error: 00780C9CF97F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:355:
rallly-1     | ] {
rallly-1     |   library: 'SSL routines',
rallly-1     |   reason: 'wrong version number',
rallly-1     |   code: 'ESOCKET',
rallly-1     |   command: 'CONN'
rallly-1     | }

Id like to point out that we use this email server with many other apps without issue, we just always use TLS and disable cert verification.

@michnovka
Copy link

With latest rally version sending emails works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants