Skip to content

Commit

Permalink
fix: Add authentication only if user_name & password
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Dec 9, 2024
1 parent cded3f9 commit 67563e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,18 @@
config.action_mailer.default_url_options = { port: 3000 }
else
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
smtp_settings = {
address: Rails.application.secrets.smtp_address,
port: Rails.application.secrets.smtp_port,
authentication: Rails.application.secrets.smtp_authentication,
user_name: Rails.application.secrets.smtp_username,
password: Rails.application.secrets.smtp_password,
domain: Rails.application.secrets.smtp_domain,
enable_starttls_auto: Rails.application.secrets.smtp_starttls_auto,
openssl_verify_mode: "none"
}
smtp_settings = smtp_settings.merge(authentication: Rails.application.secrets.smtp_authentication) if smtp_settings[:user_name].present? && smtp_settings[:password].present?

config.action_mailer.smtp_settings = smtp_settings

if Rails.application.secrets.sendgrid
config.action_mailer.default_options = {
Expand Down

0 comments on commit 67563e4

Please sign in to comment.