superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.85k stars 336 forks source link

[feature] Support SMTPS (smtp with implicit tls) rather than just STARTTLS #3372

Open vivlim opened 1 month ago

vivlim commented 1 month ago

Describe the bug with a clear and concise description of what the bug is.

If SMTP is configured using a SSL port, emails will not be sent, and any attempts to use the /api/v1/admin/email/test endpoint will hang.

With my nginx reverse proxy config, the request will time out after 60 seconds and return a 504. gotosocial's logs (at least at the default level) don't contain any hints when this happens.

To reproduce, with either smtp2go or mailgun, set the smtp server and port to one of these combinations: mail.smtp2go.com:(465|8465|443) smtp.mailgun.org:465 (other providers likely work for repro also)

I don't really understand how 'SSL' and 'TLS' are used in the context of smtp, but the docs mention that the server needs to present valid ssl certificates, and smtp2go & mailgun describe those ports as "SSL" so it's really easy to end up with an invalid configuration and not know why.

Also... I don't know if this only reproduces on nixos, I don't have a non-nixos server handy to test this on.

What's your GoToSocial Version?

0.16.0 and 0.17.0-rc1

GoToSocial Arch

x86_64, built on nixos

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Anything else we need to know?

No response

tsmethurst commented 1 month ago

With mailgun, does it work if you set the port to 567? The smtp package we use is rather out of date and only supports STARTTLS, annoyingly, so we need to change that, see https://github.com/superseriousbusiness/gotosocial/pull/3240 and discussion for more info (I'm not sure why it was closed, but we'll pick it up again soon(tm)).

vivlim commented 1 month ago

Yeah, 567 works fine.

IMO I think a decent enough no-code stopgap would be to mention the limitation in the docs.

tsmethurst commented 1 month ago

Good idea, I'll change the docs.

tsmethurst commented 1 month ago

Ah sorry I meant 587, not 567, not sure what was going through my head there :')

tsmethurst commented 1 month ago

I renamed this and changed it to a feature request for smtps, hope that's OK :)