2
0

Fix SMTP configuration with mail 2.9.0 (#36646)

This commit is contained in:
Claire
2025-10-30 12:21:32 +01:00
parent 2a9c7d2b9e
commit e4291e9b05
3 changed files with 38 additions and 23 deletions

View File

@@ -8,25 +8,23 @@ module Mastodon
# `config/email.yml`) into the format that `ActionMailer` understands
def convert_smtp_settings(config)
enable_starttls = nil
enable_starttls_auto = nil
case config[:enable_starttls]
when 'always'
enable_starttls = true
when 'never'
enable_starttls = :always
when 'never', 'false'
enable_starttls = false
when 'auto'
enable_starttls_auto = true
enable_starttls = :auto
else
enable_starttls_auto = config[:enable_starttls_auto] != 'false'
enable_starttls = config[:enable_starttls_auto] ? :auto : false unless config[:tls] || config[:ssl]
end
authentication = config[:authentication] == 'none' ? nil : (config[:authentication] || 'plain')
config.merge(
config.without(:enable_starttls_auto).merge(
authentication:,
enable_starttls:,
enable_starttls_auto:
enable_starttls:
)
end
end