Fix and provide sane defaults for SMTP #686
No reviewers
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#686
Loading…
Reference in a new issue
No description provided.
Delete branch "Oneric/akkoma:smtp-defaults"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
OTP’s default SSL/TLS settings are rather restricitive and in particular do not use sysem CA certs. This lead to #660 once verification failures became an error by default in OTP 26.
This root-cause and some somehwat-working workaround were already identified in the Swoosh issue linked from #660. Acutally choosing the right config or getting this to work with in-database config isn’t immediately obvious though.
Now that some time passed it seems like Swoosh does (atm) not intend to provide their own defaults over OTP’s and it appears neither does gen_smtp, therefore lets set defaults appropiate for “sending emails via an external SMTP server” outselves.
Additionally complexity comes from gen_smtp using its
tls_options
exclusively forSTARTTLS
upgrades and not for direct TLS connections (and appending TLS-specific options tosockopts
when using plain TCP being abadarg
error).This change deals with all of that and should make things simple again for admins.
I tested this with a direct SSL mailserver and verfied that if trying to connect via plain/
STARTTLS
the connection times out as expected rather then running into errors early (the mail server drops plain traffic coming to the SMTP port). I.e. a config like this:It should also work for servers limited to
STARTTLS
(or a theoretical plain-TCP-only server) but i can’t personally test this. If someone could check and report back that it works, it’d be great ^^ (i.e. a server which needs or at least accepts:ssl: false, tls: :always
)This fixed the issue on akko.wtf.
@ -62,3 +62,2 @@
defp parse_config(config) do
Swoosh.Mailer.parse_config(@otp_app, __MODULE__, @mailer_config, config)
defp ensure_charlist(input) do
minor stylistic thing that i'm not going to make you change
this would probably have been cleaner as two function definitions
something to bear in mind for future
tests pass, fixes for someone that had the issue and does not break my previously working setup
all good, thanks!