Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Added option to skip TLS verification for mailer (#1291)

Florian Krauthaneb34a2f9de5b
diff --git a/.env.example b/.env.example
index 2928bcc1c9..f5e98e7a4e 100644
--- a/.env.example
+++ b/.env.example
@@ -74,6 +74,7 @@ SMTP_PORT=465
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_TLS_ENABLED=true
+SMTP_TLS_SKIP_VERIFY=false
# Address that emails are sent from
EMAIL_SENDER=
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 347a186177..f035084367 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -78,11 +78,12 @@ Rails.application.configure do
config.action_mailer.default_url_options = { host: ENV["APP_DOMAIN"] }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
- address: ENV["SMTP_ADDRESS"],
- port: ENV["SMTP_PORT"],
- user_name: ENV["SMTP_USERNAME"],
- password: ENV["SMTP_PASSWORD"],
- tls: ENV["SMTP_TLS_ENABLED"] == "true"
+ address: ENV["SMTP_ADDRESS"],
+ port: ENV["SMTP_PORT"],
+ user_name: ENV["SMTP_USERNAME"],
+ password: ENV["SMTP_PASSWORD"],
+ tls: ENV["SMTP_TLS_ENABLED"] == "true",
+ openssl_verify_mode: ENV["SMTP_TLS_SKIP_VERIFY"] == "true" ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
}
# Ignore bad email addresses and do not raise email delivery errors.