]> cat aescling's git repositories - mastodon.git/commitdiff
Allow using an SMTP server without authentication (#1597)
authorMiguel Jacq <mig@mig5.net>
Mon, 17 Apr 2017 08:41:19 +0000 (18:41 +1000)
committerEugen <eugen@zeonfederated.com>
Mon, 17 Apr 2017 08:41:19 +0000 (10:41 +0200)
* Allow using an SMTP server without authentication (e.g Postfix relay on the same host) by setting SMTP_LOGIN and SMTP_AUTH_METHOD to 'none'

* Add note in .env.production.sample about SMTP settings for servers where no auth is required

* Assume that SMTP_LOGIN and SMTP_PASSWORD will be blank if we set SMTP_AUTH_METHOD to none

.env.production.sample
config/environments/production.rb

index 6555cb12a2ec84204a797217a002cd16c1be4803..0759ed7faf51ffe14234bbd8606d0c488d4a9338 100644 (file)
@@ -35,6 +35,8 @@ OTP_SECRET=
 
 # E-mail configuration
 # Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers
+# If you want to use an SMTP server without authentication (e.g local Postfix relay)
+# then set SMTP_AUTH_METHOD to 'none' and leave SMTP_LOGIN and SMTP_PASSWORD blank
 SMTP_SERVER=smtp.mailgun.org
 SMTP_PORT=587
 SMTP_LOGIN=
index 80021287a5291651567343c67ec1b03036f9dc04..a4cdb273232870b33d3c6e3039fdf4b30352c90c 100644 (file)
@@ -100,8 +100,10 @@ Rails.application.configure do
     :address              => ENV['SMTP_SERVER'],
     :user_name            => ENV['SMTP_LOGIN'],
     :password             => ENV['SMTP_PASSWORD'],
+
     :domain               => ENV['SMTP_DOMAIN'] || ENV['LOCAL_DOMAIN'],
-    :authentication       => ENV['SMTP_AUTH_METHOD'] || :plain,
+    :authentication       => ENV['SMTP_AUTH_METHOD'] == 'none' ? nil : ENV['SMTP_AUTH_METHOD'] || :plain,
+
     :openssl_verify_mode  => ENV['SMTP_OPENSSL_VERIFY_MODE'],
     :enable_starttls_auto => ENV['SMTP_ENABLE_STARTTLS_AUTO'] || true,
   }