diff --git a/config/environments/production.rb b/config/environments/production.rb index 031c9d2cb..173318fe3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -11,12 +11,13 @@ Rails.application.configure do config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: smtp_address, - port: ENV.fetch("SMTP_PORT", "587").to_i, + port: ENV.fetch("SMTP_PORT", ENV["SMTP_TLS"] == "true" ? "465" : "587").to_i, domain: ENV.fetch("SMTP_DOMAIN", nil), user_name: ENV.fetch("SMTP_USERNAME", nil), password: ENV.fetch("SMTP_PASSWORD", nil), authentication: ENV.fetch("SMTP_AUTHENTICATION", "plain"), - enable_starttls_auto: ENV.fetch("SMTP_ENABLE_STARTTLS_AUTO", "true") == "true" + tls: ENV["SMTP_TLS"] == "true", + openssl_verify_mode: ENV["SMTP_SSL_VERIFY_MODE"] } end diff --git a/docs/docker-deployment.md b/docs/docker-deployment.md index 15ec58367..f92b80ca2 100644 --- a/docs/docker-deployment.md +++ b/docs/docker-deployment.md @@ -78,14 +78,15 @@ You can then plug all your SMTP settings from that provider into Fizzy via the f - `MAILER_FROM_ADDRESS` - the "from" address that Fizzy should use to send email - `SMTP_ADDRESS` - the address of the SMTP server you'll send through -- `SMTP_PORT` - the port number you use to connect to that SMTP server (the default is 587) +- `SMTP_PORT` - the port number (defaults to 465 when `SMTP_TLS` is set, 587 otherwise) - `SMTP_USERNAME`/`SMTP_PASSWORD` - the credentials for logging in to the SMTP server Less commonly, you might also need to set some of the following: +- `SMTP_TLS` - set to `true` only for servers requiring implicit TLS (SMTPS on port 465); STARTTLS is used automatically by default so most servers don't need this - `SMTP_DOMAIN` - the domain name advertised to the server when connecting - `SMTP_AUTHENTICATION` - if you need an authentication method other than the default `plain` -- `SMTP_ENABLE_STARTTLS_AUTO` - if you need to disable TLS on the SMTP connection +- `SMTP_SSL_VERIFY_MODE` - set to `none` to skip certificate verification (for self-signed certs) You can find out more about all these settings in the [Rails Action Mailer documentation](https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration).