Email delivery configuration moved to an unversioned YAML file (config/email.yml, see the sample file) (#1412).

Email delivery is disabled. It's automatically turned on when configuration is found.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1625 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-07-04 18:55:45 +00:00
parent 5d0b53544c
commit fc42dd2cef
37 changed files with 89 additions and 32 deletions

View File

@ -39,6 +39,7 @@ class SettingsController < ApplicationController
end end
@options = {} @options = {}
@options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] } @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] }
@deliveries = ActionMailer::Base.perform_deliveries
end end
def plugin def plugin

View File

@ -1,3 +1,4 @@
<% if @deliveries %>
<% form_tag({:action => 'edit', :tab => 'notifications'}) do %> <% form_tag({:action => 'edit', :tab => 'notifications'}) do %>
<div class="box tabular settings"> <div class="box tabular settings">
@ -28,3 +29,8 @@
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>
<% end %> <% end %>
<% else %>
<div class="nodata">
<%= simple_format(l(:text_email_delivery_not_configured)) %>
</div>
<% end %>

21
config/email.yml.example Normal file
View File

@ -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

View File

@ -50,24 +50,8 @@ Rails::Initializer.run do |config|
# (enables use of different database adapters for development and test environments) # (enables use of different database adapters for development and test environments)
# config.active_record.schema_format = :ruby # config.active_record.schema_format = :ruby
# See Rails::Configuration for more options # Deliveries are disabled by default. Do NOT modify this section.
# Define your email configuration in email.yml instead.
# SMTP server configuration # It will automatically turn deliveries on
config.action_mailer.smtp_settings = { config.action_mailer.perform_deliveries = false
: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
end end

View File

@ -13,4 +13,5 @@ config.whiny_nils = true
config.action_controller.consider_all_requests_local = true config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test

View File

@ -13,4 +13,5 @@ config.whiny_nils = true
config.action_controller.consider_all_requests_local = true config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test

View File

@ -13,4 +13,5 @@ config.whiny_nils = true
config.action_controller.consider_all_requests_local = true config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test

View File

@ -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

View File

@ -53,10 +53,10 @@ Optional:
trackers, statuses, workflow) and adjust application settings trackers, statuses, workflow) and adjust application settings
== SMTP server Configuration == Email delivery 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
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. Don't forget to restart the application after any change to this file.
Please do not enter your SMTP settings in environment.rb.

View File

@ -10,15 +10,13 @@ http://www.redmine.org/
1. Uncompress the program archive in a new directory 1. Uncompress the program archive in a new directory
3. Copy your database settings (RAILS_ROOT/config/database.yml) 3. Copy your database settings (RAILS_ROOT/config/database.yml)
and SMTP settings (RAILS_ROOT/config/email.yml)
into the new config directory into the new config directory
4. Enter your SMTP settings in config/environment.rb 4. Migrate your database (please make a backup before doing this):
Do not replace this file with the old one
5. Migrate your database (please make a backup before doing this):
rake db:migrate RAILS_ENV="production" 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 This directory contains all the attached files

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -636,3 +636,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -633,3 +633,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -606,6 +606,7 @@ text_reassign_time_entries: 'Reassign reported hours to this issue:'
text_user_wrote: '%s wrote:' text_user_wrote: '%s wrote:'
text_enumeration_destroy_question: '%d objects are assigned to this value.' text_enumeration_destroy_question: '%d objects are assigned to this value.'
text_enumeration_category_reassign_to: 'Reassign them 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_manager: Manager
default_role_developper: Developer default_role_developper: Developer

View File

@ -634,3 +634,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -606,6 +606,7 @@ text_reassign_time_entries: 'Reporter les heures sur cette demande:'
text_user_wrote: '%s a écrit:' text_user_wrote: '%s a écrit:'
text_enumeration_destroy_question: 'Cette valeur est affectée à %d objets.' text_enumeration_destroy_question: 'Cette valeur est affectée à %d objets.'
text_enumeration_category_reassign_to: 'Réaffecter les objets à cette valeur:' 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_manager: Manager
default_role_developper: Développeur default_role_developper: Développeur

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -632,3 +632,4 @@ label_incoming_emails: Beérkezett levelek
label_generate_key: Kulcs generálása 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_enabled: Web Service engedélyezése a beérkezett levelekhez
setting_mail_handler_api_key: API kulcs 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."

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -634,3 +634,4 @@ label_generate_key: Generuoti raktą
setting_mail_handler_api_enabled: Įgalinti WS įeinantiems laiškams setting_mail_handler_api_enabled: Įgalinti WS įeinantiems laiškams
setting_mail_handler_api_key: API raktas 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."

View File

@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -631,3 +631,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -635,3 +635,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -632,3 +632,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -634,3 +634,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -633,3 +633,4 @@ label_incoming_emails: Incoming emails
label_generate_key: Generate a key label_generate_key: Generate a key
setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key 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."

View File

@ -632,3 +632,4 @@ default_activity_development: 開發
enumeration_issue_priorities: 項目優先權 enumeration_issue_priorities: 項目優先權
enumeration_doc_categories: 文件分類 enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (時間追蹤) 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."

View File

@ -632,3 +632,4 @@ default_activity_development: 开发
enumeration_issue_priorities: 问题优先级 enumeration_issue_priorities: 问题优先级
enumeration_doc_categories: 文档类别 enumeration_doc_categories: 文档类别
enumeration_activities: 活动(时间跟踪) 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."