diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index c7c8751..59b9c67 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -39,6 +39,7 @@ class SettingsController < ApplicationController
end
@options = {}
@options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] }
+ @deliveries = ActionMailer::Base.perform_deliveries
end
def plugin
diff --git a/app/views/settings/_notifications.rhtml b/app/views/settings/_notifications.rhtml
index 1a472d6..3670146 100644
--- a/app/views/settings/_notifications.rhtml
+++ b/app/views/settings/_notifications.rhtml
@@ -1,3 +1,4 @@
+<% if @deliveries %>
<% form_tag({:action => 'edit', :tab => 'notifications'}) do %>
@@ -28,3 +29,8 @@
<%= submit_tag l(:button_save) %>
<% end %>
+<% else %>
+
+<%= simple_format(l(:text_email_delivery_not_configured)) %>
+
+<% end %>
diff --git a/config/email.yml.example b/config/email.yml.example
new file mode 100644
index 0000000..a67c122
--- /dev/null
+++ b/config/email.yml.example
@@ -0,0 +1,21 @@
+# Outgoing email settings
+
+production:
+ delivery_method: :smtp
+ smtp_settings:
+ address: smtp.somenet.foo
+ port: 25
+ domain: somenet.foo
+ authentication: :login
+ user_name: redmine@somenet.foo
+ password: redmine
+
+development:
+ delivery_method: :smtp
+ smtp_settings:
+ address: 127.0.0.1
+ port: 25
+ domain: somenet.foo
+ authentication: :login
+ user_name: redmine@somenet.foo
+ password: redmine
diff --git a/config/environment.rb b/config/environment.rb
index b0f16c3..9a3bf4b 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -49,25 +49,9 @@ Rails::Initializer.run do |config|
# Use Active Record's schema dumper instead of SQL when creating the test database
# (enables use of different database adapters for development and test environments)
# config.active_record.schema_format = :ruby
-
- # See Rails::Configuration for more options
- # SMTP server configuration
- config.action_mailer.smtp_settings = {
- :address => "127.0.0.1",
- :port => 25,
- :domain => "somenet.foo",
- :authentication => :login,
- :user_name => "redmine@somenet.foo",
- :password => "redmine",
- }
-
- config.action_mailer.perform_deliveries = true
-
- # Tell ActionMailer not to deliver emails to the real world.
- # The :test delivery method accumulates sent emails in the
- # ActionMailer::Base.deliveries array.
- #config.action_mailer.delivery_method = :test
- config.action_mailer.delivery_method = :smtp
-
+ # Deliveries are disabled by default. Do NOT modify this section.
+ # Define your email configuration in email.yml instead.
+ # It will automatically turn deliveries on
+ config.action_mailer.perform_deliveries = false
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 9ba9ae0..7c821da 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -13,4 +13,5 @@ config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
+config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :test
diff --git a/config/environments/test_pgsql.rb b/config/environments/test_pgsql.rb
index 35bb19b..7c821da 100644
--- a/config/environments/test_pgsql.rb
+++ b/config/environments/test_pgsql.rb
@@ -13,4 +13,5 @@ config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
-config.action_mailer.delivery_method = :test
\ No newline at end of file
+config.action_mailer.perform_deliveries = true
+config.action_mailer.delivery_method = :test
diff --git a/config/environments/test_sqlite3.rb b/config/environments/test_sqlite3.rb
index 35bb19b..7c821da 100644
--- a/config/environments/test_sqlite3.rb
+++ b/config/environments/test_sqlite3.rb
@@ -13,4 +13,5 @@ config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
-config.action_mailer.delivery_method = :test
\ No newline at end of file
+config.action_mailer.perform_deliveries = true
+config.action_mailer.delivery_method = :test
diff --git a/config/initializers/40-email.rb b/config/initializers/40-email.rb
new file mode 100644
index 0000000..5b388ec
--- /dev/null
+++ b/config/initializers/40-email.rb
@@ -0,0 +1,17 @@
+# Loads action_mailer settings from email.yml
+# and turns deliveries on if configuration file is found
+
+filename = File.join(File.dirname(__FILE__), '..', 'email.yml')
+if File.file?(filename)
+ mailconfig = YAML::load_file(filename)
+
+ if mailconfig.is_a?(Hash) && mailconfig.has_key?(Rails.env)
+ # Enable deliveries
+ ActionMailer::Base.perform_deliveries = true
+
+ mailconfig[Rails.env].each do |k, v|
+ v.symbolize_keys! if v.respond_to?(:symbolize_keys!)
+ ActionMailer::Base.send("#{k}=", v)
+ end
+ end
+end
diff --git a/doc/INSTALL b/doc/INSTALL
index 87a2b38..13502f8 100644
--- a/doc/INSTALL
+++ b/doc/INSTALL
@@ -53,10 +53,10 @@ Optional:
trackers, statuses, workflow) and adjust application settings
-== SMTP server Configuration
-
-In config/environment.rb, you can set parameters for your SMTP server:
-config.action_mailer.smtp_settings: SMTP server configuration
-config.action_mailer.perform_deliveries: set to false to disable mail delivering
+== Email delivery Configuration
+Copy config/email.yml.example to config/email.yml and edit this file
+to adjust your SMTP settings.
Don't forget to restart the application after any change to this file.
+
+Please do not enter your SMTP settings in environment.rb.
diff --git a/doc/UPGRADING b/doc/UPGRADING
index 2edb295..1dd9011 100644
--- a/doc/UPGRADING
+++ b/doc/UPGRADING
@@ -10,15 +10,13 @@ http://www.redmine.org/
1. Uncompress the program archive in a new directory
3. Copy your database settings (RAILS_ROOT/config/database.yml)
+ and SMTP settings (RAILS_ROOT/config/email.yml)
into the new config directory
-4. Enter your SMTP settings in config/environment.rb
- Do not replace this file with the old one
-
-5. Migrate your database (please make a backup before doing this):
+4. Migrate your database (please make a backup before doing this):
rake db:migrate RAILS_ENV="production"
-6. Copy the RAILS_ROOT/files directory content into your new installation
+5. Copy the RAILS_ROOT/files directory content into your new installation
This directory contains all the attached files
diff --git a/lang/bg.yml b/lang/bg.yml
index fd6e7e6..c87e3be 100644
--- a/lang/bg.yml
+++ b/lang/bg.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/cs.yml b/lang/cs.yml
index 2c76072..6669c6c 100644
--- a/lang/cs.yml
+++ b/lang/cs.yml
@@ -636,3 +636,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/da.yml b/lang/da.yml
index d51d308..cf40e17 100644
--- a/lang/da.yml
+++ b/lang/da.yml
@@ -633,3 +633,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/de.yml b/lang/de.yml
index 2bc0a16..adc3dd4 100644
--- a/lang/de.yml
+++ b/lang/de.yml
@@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/en.yml b/lang/en.yml
index 180a705..7910946 100644
--- a/lang/en.yml
+++ b/lang/en.yml
@@ -606,6 +606,7 @@ text_reassign_time_entries: 'Reassign reported hours to this issue:'
text_user_wrote: '%s wrote:'
text_enumeration_destroy_question: '%d objects are assigned to this value.'
text_enumeration_category_reassign_to: 'Reassign them to this value:'
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
default_role_manager: Manager
default_role_developper: Developer
diff --git a/lang/es.yml b/lang/es.yml
index 44d4819..4205402 100644
--- a/lang/es.yml
+++ b/lang/es.yml
@@ -634,3 +634,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/fi.yml b/lang/fi.yml
index 27f3415..b69b075 100644
--- a/lang/fi.yml
+++ b/lang/fi.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/fr.yml b/lang/fr.yml
index 89b0b4c..5b0f04f 100644
--- a/lang/fr.yml
+++ b/lang/fr.yml
@@ -606,6 +606,7 @@ text_reassign_time_entries: 'Reporter les heures sur cette demande:'
text_user_wrote: '%s a écrit:'
text_enumeration_destroy_question: 'Cette valeur est affectée à %d objets.'
text_enumeration_category_reassign_to: 'Réaffecter les objets à cette valeur:'
+text_email_delivery_not_configured: "L'envoi de mail n'est pas configuré, les notifications sont désactivées.\nConfigurez votre serveur SMTP dans config/email.yml et redémarrez l'application pour les activer."
default_role_manager: Manager
default_role_developper: Développeur
diff --git a/lang/he.yml b/lang/he.yml
index 501cfdc..030e09d 100644
--- a/lang/he.yml
+++ b/lang/he.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/hu.yml b/lang/hu.yml
index 6f88eb9..046916b 100644
--- a/lang/hu.yml
+++ b/lang/hu.yml
@@ -632,3 +632,4 @@ label_incoming_emails: Beérkezett levelek
label_generate_key: Kulcs generálása
setting_mail_handler_api_enabled: Web Service engedélyezése a beérkezett levelekhez
setting_mail_handler_api_key: API kulcs
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/it.yml b/lang/it.yml
index 14dc86f..eb83540 100644
--- a/lang/it.yml
+++ b/lang/it.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/ja.yml b/lang/ja.yml
index 5bdc3b5..cba410f 100644
--- a/lang/ja.yml
+++ b/lang/ja.yml
@@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/ko.yml b/lang/ko.yml
index 8e0d35e..2b5b0eb 100644
--- a/lang/ko.yml
+++ b/lang/ko.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/lt.yml b/lang/lt.yml
index 0f80a94..52b6b6f 100644
--- a/lang/lt.yml
+++ b/lang/lt.yml
@@ -634,3 +634,4 @@ label_generate_key: Generuoti raktą
setting_mail_handler_api_enabled: Įgalinti WS įeinantiems laiškams
setting_mail_handler_api_key: API raktas
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/nl.yml b/lang/nl.yml
index d1facc7..09cdc3c 100644
--- a/lang/nl.yml
+++ b/lang/nl.yml
@@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/no.yml b/lang/no.yml
index bf25a15..eb1ff59 100644
--- a/lang/no.yml
+++ b/lang/no.yml
@@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/pl.yml b/lang/pl.yml
index 28c5f19..9c5a382 100644
--- a/lang/pl.yml
+++ b/lang/pl.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/pt-br.yml b/lang/pt-br.yml
index 04c3b34..1582e56 100644
--- a/lang/pt-br.yml
+++ b/lang/pt-br.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/pt.yml b/lang/pt.yml
index 5a1ffc2..a5b703f 100644
--- a/lang/pt.yml
+++ b/lang/pt.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/ro.yml b/lang/ro.yml
index 3a1696c..3fa154d 100644
--- a/lang/ro.yml
+++ b/lang/ro.yml
@@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/ru.yml b/lang/ru.yml
index 7d0707f..5d59ec1 100644
--- a/lang/ru.yml
+++ b/lang/ru.yml
@@ -635,3 +635,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/sr.yml b/lang/sr.yml
index 5b8e5d9..fa1b4d8 100644
--- a/lang/sr.yml
+++ b/lang/sr.yml
@@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/sv.yml b/lang/sv.yml
index 4c6170f..9015099 100644
--- a/lang/sv.yml
+++ b/lang/sv.yml
@@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/th.yml b/lang/th.yml
index e7f276a..27f7b14 100644
--- a/lang/th.yml
+++ b/lang/th.yml
@@ -634,3 +634,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/uk.yml b/lang/uk.yml
index 275de0e..0286779 100644
--- a/lang/uk.yml
+++ b/lang/uk.yml
@@ -633,3 +633,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/zh-tw.yml b/lang/zh-tw.yml
index 9b43ed4..0e8fabe 100644
--- a/lang/zh-tw.yml
+++ b/lang/zh-tw.yml
@@ -632,3 +632,4 @@ default_activity_development: 開發
enumeration_issue_priorities: 項目優先權
enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (時間追蹤)
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
diff --git a/lang/zh.yml b/lang/zh.yml
index 2bd0880..1cde9f5 100644
--- a/lang/zh.yml
+++ b/lang/zh.yml
@@ -632,3 +632,4 @@ default_activity_development: 开发
enumeration_issue_priorities: 问题优先级
enumeration_doc_categories: 文档类别
enumeration_activities: 活动(时间跟踪)
+text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."