Skip to content

Commit

Permalink
Fixes mailer settings to include environment variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Scherz committed Jul 23, 2024
1 parent 157469e commit 63f6a88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ APP_PORTFOLIO_PRODUCTION_MAILER_URL=localhost:3000
#reCaptcha settings
APP_PORTFOLIO_reCAPTCHA_SITE_KEY=""
APP_PORTFOLIO_reCAPTCHA_SECRET_KEY=""

#mailer settings
MAIL_SMTP_ADDRESS='localhost'
3 changes: 3 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ APP_PORTFOLIO_DATABASE_TIMEOUT=5000
APP_PORTFOLIO_DATABASE_USERNAME=

APP_PORTFOLIO_PRODUCTION_MAILER_URL=localhost:3000

#mailer settings
MAIL_SMTP_ADDRESS='localhost'
9 changes: 6 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,19 @@
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "application_portfolio_#{Rails.env}"

# Configure Secure Sendmail mailer
config.action_mailer.raise_delivery_errors = true

config.action_mailer.perform_caching = false
config.action_mailer.default_options = { from: '[email protected]' }
config.mailer_from = '[email protected]'
config.action_mailer.delivery_method = :smtp
# Store the base url from where request is received.
config.action_mailer.default_url_options = { host: ENV['APP_PORTFOLIO_PRODUCTION_MAILER_URL'] }

# updated for tls and sendmail
config.action_mailer.smtp_settings = {
enable_starttls_auto: true,
# 'address' specifies the address of the server that will handle email sending.
address: ENV['MAIL_SMTP_ADDRESS'],
# 'port' specifies which port to use on the SMTP server.
port: 25,
# 'ca_file' is the path to the certificate authority file.
# In our case, it's a self-signed certificate. This tells Rails to trust this specific certificate.
Expand Down

0 comments on commit 63f6a88

Please sign in to comment.