Added optional SMTP_OPENSSL_VERIFY_MODE (#1703)

* Added optional SMTP_OPENSSL_VERIFY_MODE to fix mailserver certificate issues

* Added optional SMTP_OPENSSL_VERIFY_MODE

Fixed to long line. [139/130]

* Fix multi-line indent

* Remove elseif statements and use much shorter way of checking for SMTP_OPENSSL_VERIFY_MODE

* Too long line again

* Moved SMTP_OPENSSL_VERIFY_OPTION. Specified what it does. Added security warning

Co-authored-by: Ahmad Farhat <ahmad.af.farhat@gmail.com>
This commit is contained in:
LifeEncrypter 2020-06-03 16:13:08 +02:00 committed by GitHub
parent 13fb9faa4c
commit b297fdfbaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -101,6 +101,10 @@ Rails.application.configure do
} }
end 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?
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true

View File

@ -121,6 +121,9 @@ GOOGLE_ANALYTICS_TRACKING_ID=
# SMTP_AUTH=plain # SMTP_AUTH=plain
# SMTP_STARTTLS_AUTO=true # SMTP_STARTTLS_AUTO=true
# #
# Comment this out to disable SMTP certificate verification. This option may pose a security risk.
# SMTP_OPENSSL_VERIFY_MODE=none
#
SMTP_SERVER= SMTP_SERVER=
SMTP_PORT= SMTP_PORT=
SMTP_DOMAIN= SMTP_DOMAIN=