lukevella / rallly-selfhosted

Example docker configuration for running your own instance of Rallly
https://rallly.co
109 stars 14 forks source link

local smtp server - Error sending email #6

Closed abuhamsa closed 1 year ago

abuhamsa commented 1 year ago

Hi I'm trying to get rallly running in my homelab. But I'm stuck at the mail delivery. If i try to register any account I get the following output in console: Error sending email

This seems to be from here https://github.com/lukevella/rallly/blob/1bc749e17a909a77480e7b9eebebe8002ebc0da7/packages/emails/src/send-email.tsx#L123

Any chance to enrich this message?

I logged in to the container and added telnet to see if i can connect to my smtp server over port 25 and this works. I also tried like every possible setting with SMTP_SECURE/SMTP_TLS_ENABLED since my server is also listening to 465 with SSL

lukevella commented 1 year ago

Hi @abuhamsa. Yeh I can see that the error message is being eaten up there. Will push a fix for that in the next release but in the meantime I pushed a new tag to docker hub that should log the error for you. Can you set your tag to log-email-error and see if that helps?

abuhamsa commented 1 year ago

i'll have time to test in a few hours will keep you updated

abuhamsa commented 1 year ago

hi @lukevella the extended error message helped. it seems that even if I config port 25 and saying it's neither secure or tls that it makes a certificate check. which leads to an error that my local ip isnt listed in the certificate: Error sending email Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames

There are maybe like 2 more environment-variables for nodemailer that could be set to help here: https://nodemailer.com/smtp/#tls-options

Maybe I'm the only one with this setup so no pressure from my side.

lukevella commented 1 year ago

The current available options should be enough if your SMTP server is "properly" configured. I don't know enough about your setup to give advice but I think this can be fixed by updating your certificate to include the hostname of your SMTP server, assuming you're not using an IP address as your SMTP server hostname.

I'll go ahead and close this issue. Thanks for pointing out the missing error log.

abuhamsa commented 1 year ago

assuming you're not using an IP address as your SMTP server hostname. that's exactly what I do. It is only my homelab. So i thought that should work if i call my internal SMTP-Server over IP I can work around so I'm fine.

lukevella commented 1 year ago

If it's all running inside a local network is it really necessary to use TLS?

abuhamsa commented 1 year ago

of course it's not but even with

SMTP_PORT=25
SMTP_SECURE=false
SMTP_TLS_ENABLED=false

it throws the error above.

lukevella commented 1 year ago

Sounds like it's the SMTP server requiring the TLS then. Perhaps you can configure it not to do that.