From a0122b5cea2ebf6e476b881405b692e9bad5df38 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Sat, 18 Jan 2025 14:10:49 +0800 Subject: [PATCH] chore: update action mailer configuration - Set host option for action mailer to use ENV variable - Added SSL, open timeout, and read timeout settings - Ensure authentication method is a string These changes streamline the action mailer configuration by introducing additional parameters for a more secure and efficient operation, improving overall email delivery reliability. --- config/environments/production.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 724ae01..5537dde 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -59,7 +59,7 @@ Rails.application.configure do # Set host to be used by links generated in mailer templates. # config.action_mailer.default_url_options = { host: "example.com" } - config.action_mailer.default_url_options = ENV.fetch("RAILS_BASE_URL", "example.com") + config.action_mailer.default_url_options = { host: ENV.fetch("RAILS_BASE_URL", "example.com") } config.action_mailer.delivery_method = :smtp # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. @@ -68,7 +68,10 @@ Rails.application.configure do password: ENV.fetch("RAILS_SMTP_PASSWORD", Rails.application.credentials.smtp.password), address: ENV.fetch("RAILS_SMTP_HOST", Rails.application.credentials.smtp.address), port: ENV.fetch("RAILS_SMTP_PORT", 465), - authentication: :plain + ssl: ENV.fetch("RAILS_SMTP_SSL", true), + open_timeout: 5, + read_timeout: 5, + authentication: "plain" } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to