From 57bafae61d326d2262364c3fb1a22c3fe2c86f2e Mon Sep 17 00:00:00 2001 From: davidg73 <david.gunnarsson@univie.ac.at> Date: Wed, 14 May 2025 17:02:48 +0200 Subject: [PATCH] Configure smtp on server --- config/credentials/production.yml.enc | 2 +- config/environments/production.rb | 30 +++++++++++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/config/credentials/production.yml.enc b/config/credentials/production.yml.enc index cbfd3e7..5dffade 100644 --- a/config/credentials/production.yml.enc +++ b/config/credentials/production.yml.enc @@ -1 +1 @@ -ZA7UQSN8UAcJBh1wEJFCGqUo/+1ZajmLXXUEU3mDEPyc3CNVyO4Jhq3Plr2fsO9XCf7C16lmlSKNIPWvnhHdo/7vEN90TLLCVNWA3MjOv7syDLSS891944ERjTq5cvj/4if8U4djUDyR24oR+GXEKs5TOAa+UdFGDWBH3TVj1xHBH4e2+f89ofCLZkblxkH8k393mKRTea/Kqvny9kpDcSCP2uBM//wE06pxUplL2lpfwOM83VdPA/FsyicF3a6LygRDlEaM1coIdDBNvoFpbT+siSzl8HIyvAi7Mxgg8eDre603I1mTbO9daVGyVJ2496kAbV1kl69Pi9vGS8118tyIZgJXzf/dG4XW82nQPUGdYE36EaEXwtEzr/RtiPx2OL9DbwV8kYYmgaN327mNRYCkD3J4iq53j5k+LKO+OHfC968TvLQD8Go2YjgwDowN5O2HDSWAWuhkWg05230cB+DmGjzJxa5emAEdNjQIEfGSaThNg9g383qZ--UZ42pf71HUb2flZ6--tMf6wHQUrI+te9Po1GUM9A== \ No newline at end of file +7yPtPnPBurQ83tBCBz7RsAiTXIhEvtwFrG7bBwJr7VUg8Mj1Yj6Rxio3RX4bvCGue7bTEuI3sUGA5Vg7VvSNhL/gF1vPCDWktjTfzMfRSF1q4Muu6FgQwlCIsqXmYf4OEV5WDz+XO1g8PQukso3/zZDufqLpkuPMMblxJIvu0de5g31pgp/HTHtqIUo+EBlEDViBHJEY0bB0NYlQ9Hd5ne/XxVeT3tx/3y5o9lzWGnqSKZ/q49KNnIxin5y0M58baGdbtDf7oAfcPsWiR64wST0C5yEW8ch1YIWeA4PI0hSPO7Q2L7Q7/GGhJvH5nngUgO1n2fqVPAfUH6kf6NWxYUYw58514MFhpRYSrRtCkdu/HSPyZAqq+2tg1qY0989Ll7exDbOuCKaiUmx3MgTROG1IMgElrUjN21j71uArOvqLewiPeJ8GMC/BHaen6zlI4wCNec0/1rLuTmLQdh6eEzSvKGP4k/Qc02Hj1IADdpp02UT0oKVHP0lTAUKPfIspUlkagAOADf6idijPwA7vX2mrTLOy7883SEOLTPCCLRJOH8y6bnsAq2Nt/NS9r2MKG1+2eHgXu44+adSbz9wJrRUmXXSlycd/AUfYKwAW6PeGnuc=--MwQDFvuuiR/b5zPW--RZWSoS7siXHmkEEzSTMlcg== \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index 5623985..3bb7e22 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -52,21 +52,25 @@ Rails.application.configure do # Replace the default in-process and non-durable queuing backend for Active Job. # config.active_job.queue_adapter = :resque - # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to raise delivery errors. - # config.action_mailer.raise_delivery_errors = false + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { + address: Rails.application.credentials.smtp.address, + port: 587, + domain: URI.parse(ENV["DEFAULT_BASE_URL"]).host, + user_name: Rails.application.credentials.smtp.username, + password: Rails.application.credentials.smtp.password, + enable_starttls_auto: true, + min_version: OpenSSL::SSL::TLS1_2_VERSION + } # Set host to be used by links generated in mailer templates. - config.action_mailer.default_url_options = {host: "example.com"} - - # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. - # config.action_mailer.smtp_settings = { - # user_name: Rails.application.credentials.dig(:smtp, :user_name), - # password: Rails.application.credentials.dig(:smtp, :password), - # address: "smtp.example.com", - # port: 587, - # authentication: :plain - # } + config.action_mailer.default_url_options = { + host: ENV["DEFAULT_BASE_URL"], + protocol: "https" + } + + config.action_mailer.perform_deliveries = true + config.action_mailer.raise_delivery_errors = true # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). -- GitLab