Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable SMTPS: SMTP over direct TLS connection #2485

Merged
merged 9 commits into from
Mar 1, 2021
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ gem 'pluck_to_hash', '~> 1.0.2'
gem 'local_time', '~> 2.1.0'

group :production do
gem 'sqlite3', '~> 1.3.6'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done

# Use a postgres database in production.
gem 'pg', '~> 0.18'
gem 'sequel'
Expand Down
5 changes: 5 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@
}
end

# enable SMTPS: SMTP over direct TLS connection
if ENV['SMTP_TLS'].present? && ENV['SMTP_TLS'] != "false"
ActionMailer::Base.smtp_settings[:tls] = true
end

# If configured to 'none' don't check the smtp servers certificate
ActionMailer::Base.smtp_settings[:openssl_verify_mode] =
ENV['SMTP_OPENSSL_VERIFY_MODE'] if ENV['SMTP_OPENSSL_VERIFY_MODE'].present?
Expand Down
3 changes: 3 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ GOOGLE_ANALYTICS_TRACKING_ID=
# SMTP_AUTH=plain
# SMTP_STARTTLS_AUTO=true
#
# enable SMTPS: SMTP over direct TLS connection; usually port 465
# SMTP_TLS=true
#
# If your mail server has a self-signed certificate, you'll also need to include the line below.
# Please note that enable this presents its own security risks and should not be done unless necessary.
# SMTP_OPENSSL_VERIFY_MODE=none
Expand Down