feat: update smtp settings for production environment

- Update SMTP host and port
- Enable TLS and authentication for SMTP connection

This change updates the production environment configuration to use a different SMTP host and port, as well as enables TLS and authentication for the SMTP connection. This is necessary to ensure reliable and secure email delivery in the production environment.
This commit is contained in:
songtianlun 2025-01-18 14:18:08 +08:00
parent 646be909ec
commit 30da8604bb

View File

@ -64,14 +64,15 @@ Rails.application.configure do
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
user_name: ENV.fetch("RAILS_SMTP_USERNAME", Rails.application.credentials.smtp.user_name),
password: ENV.fetch("RAILS_SMTP_PASSWORD", Rails.application.credentials.smtp.password),
address: ENV.fetch("RAILS_SMTP_HOST", Rails.application.credentials.smtp.address), address: ENV.fetch("RAILS_SMTP_HOST", Rails.application.credentials.smtp.address),
port: ENV.fetch("RAILS_SMTP_PORT", 465), port: ENV.fetch("RAILS_SMTP_PORT", 465),
user_name: ENV.fetch("RAILS_SMTP_USERNAME", Rails.application.credentials.smtp.user_name),
password: ENV.fetch("RAILS_SMTP_PASSWORD", Rails.application.credentials.smtp.password),
ssl: ENV.fetch("RAILS_SMTP_SSL", true), ssl: ENV.fetch("RAILS_SMTP_SSL", true),
authentication: "plain",
enable_starttls_auto: true,
open_timeout: 5, open_timeout: 5,
read_timeout: 5, read_timeout: 5,
authentication: "plain"
} }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to