From da43e4cf292a0c503241dd54fb37008687695a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Fri, 3 Jun 2016 17:39:54 +0200 Subject: [PATCH] prevent the application from starting in development mode when SMTP settings are changed --- config/environment.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/environment.rb b/config/environment.rb index 2cbc66af8ed..bee2a432875 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,3 +3,8 @@ require File.expand_path('../application', __FILE__) # Initialize the rails application Discourse::Application.initialize! + +# When in "dev" mode, ensure we won't be sending any emails +if Rails.env.development? && ActionMailer::Base.smtp_settings != { address: "localhost", port: 1025 } + fail "In development mode, you should be using mailcatcher otherwise you might end up sending thousands of digest emails" +end