about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Mankuta <alex+github@pointless.one>2017-04-10 22:48:30 +0300
committerwxcafé <wxcafe@users.noreply.github.com>2017-04-10 21:48:30 +0200
commit0dbbc16c69652afe63d0b3dd49c06939351e3bc6 (patch)
tree5bbf6805686ddbfece30eeddeb12cc004fe97f3c
parentf690320fb93ea1a884a292f9e099eb1bc0834b6d (diff)
More SMTP customization (#1372)
* Allow SMTP auth method customization

* Add SMTP openssl_verify_mode option support

Allows one use self-signed certs with their SMTP server.

* Add SMTP enable_starttls_auto option support
-rw-r--r--.env.production.sample4
-rw-r--r--app.json12
-rw-r--r--config/environments/production.rb4
-rw-r--r--scalingo.json12
4 files changed, 31 insertions, 1 deletions
diff --git a/.env.production.sample b/.env.production.sample
index fbb284707..97bba5e3f 100644
--- a/.env.production.sample
+++ b/.env.production.sample
@@ -35,6 +35,10 @@ SMTP_PORT=587
 SMTP_LOGIN=
 SMTP_PASSWORD=
 SMTP_FROM_ADDRESS=notifications@example.com
+#SMTP_AUTH_METHOD=plain
+#SMTP_OPENSSL_VERIFY_MODE=peer
+#SMTP_ENABLE_STARTTLS_AUTO=true
+
 
 # Optional asset host for multi-server setups
 # CDN_HOST=assets.example.com
diff --git a/app.json b/app.json
index 29c1f9f9c..6c4294c79 100644
--- a/app.json
+++ b/app.json
@@ -79,6 +79,18 @@
     "SMTP_FROM_ADDRESS": {
       "description": "Address to send emails from",
       "required": false
+    },
+    "SMTP_AUTH_METHOD": {
+      "description": "Authentication method to use with SMTP server. Default is 'plain'.",
+      "required": false
+    },
+    "SMTP_OPENSSL_VERIFY_MODE": {
+      "description": "SMTP server certificate verification mode. Defaults is 'peer'.",
+      "required": false
+    },
+    "SMTP_ENABLE_STARTTLS_AUTO": {
+      "description": "Enable STARTTLS if SMTP server supports it? Default is true.",
+      "required": false
     }
   },
   "buildpacks": [
diff --git a/config/environments/production.rb b/config/environments/production.rb
index d299e4f4c..05cced67b 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -99,7 +99,9 @@ Rails.application.configure do
     :user_name      => ENV['SMTP_LOGIN'],
     :password       => ENV['SMTP_PASSWORD'],
     :domain         => ENV['SMTP_DOMAIN'] || config.x.local_domain,
-    :authentication => :plain,
+    :authentication => ENV['SMTP_AUTH_METHOD'] || :plain,
+    :openssl_verify_mode => ENV['SMTP_OPENSSL_VERIFY_MODE'] || 'peer',
+    :enable_starttls_auto => ENV['SMTP_ENABLE_STARTTLS_AUTO'] || true,
   }
 
   config.action_mailer.delivery_method = :smtp
diff --git a/scalingo.json b/scalingo.json
index d60f1529c..4afaa6b4e 100644
--- a/scalingo.json
+++ b/scalingo.json
@@ -71,6 +71,18 @@
       "description": "Address to send emails from",
       "required": false
     },
+    "SMTP_AUTH_METHOD": {
+      "description": "Authentication method to use with SMTP server. Default is 'plain'.",
+      "required": false
+    },
+    "SMTP_OPENSSL_VERIFY_MODE": {
+      "description": "SMTP server certificate verification mode. Defaults is 'peer'.",
+      "required": false
+    },
+    "SMTP_ENABLE_STARTTLS_AUTO": {
+      "description": "Enable STARTTLS if SMTP server supports it? Default is true.",
+      "required": false
+    },
     "BUILDPACK_URL": {
       "description": "Internal scalingo configuration",
       "required": true,