我通过apt-get在Ubuntu 11.10服务器上安装了Redmine 0.9.3.stable(MySQL),我也成功安装了exim4,我可以通过命令行发送邮件,如下所示:
"This is a test." | mail -s Testing myemail@gmail.com
但是当我添加我的email.yml配置文件时,我得到内部服务器错误500,这是我在config dir的email.yml:
production:
delivery_method: :smtp
smtp_settings:
address: 127.0.0.1
port: 25
domain: mydomain.com
authentication: :none
这是我从redmine日志中得到的:
ActionView::TemplateError (undefined method `[]' for nil:NilClass) on line #34 of app/views/welcome/index.rhtml:
31:
32: <% content_for :header_tags do %>
33: <%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.rss_key, :format => 'atom'},
34: :title => "#{Setting.app_title}: #{l(:label_news_latest)}") %>
35: <%= auto_discovery_link_tag(:atom, {:controller => 'projects', :action => 'activity', :key => User.current.rss_key, :format => 'atom'},
36: :title => "#{Setting.app_title}: #{l(:label_activity)}") %>
37: <% end %>
app/models/setting.rb:100:in `value='
vendor/rails/activerecord/lib/active_record/base.rb:2589:in `send'
vendor/rails/activerecord/lib/active_record/base.rb:2589:in `attributes='
vendor/rails/activerecord/lib/active_record/base.rb:2585:in `each'
vendor/rails/activerecord/lib/active_record/base.rb:2585:in `attributes='
vendor/rails/activerecord/lib/active_record/base.rb:2285:in `initialize'
app/models/setting.rb:166:in `new'
app/models/setting.rb:166:in `find_or_default'
app/models/setting.rb:107:in `[]'
app/models/setting.rb:136:in `app_title'
app/views/welcome/index.rhtml:34
vendor/rails/actionpack/lib/action_view/helpers/capture_helper.rb:36:in `call'
vendor/rails/actionpack/lib/action_view/helpers/capture_helper.rb:36:in `capture'
vendor/rails/actionpack/lib/action_view/helpers/capture_helper.rb:129:in `with_output_buffer'
vendor/rails/actionpack/lib/action_view/helpers/capture_helper.rb:36:in `capture'
vendor/rails/actionpack/lib/action_view/helpers/capture_helper.rb:120:in `content_for'
app/helpers/application_helper.rb:692:in `content_for'
app/views/welcome/index.rhtml:32
vendor/rails/actionpack/lib/action_view/renderable.rb:39:in `send'
vendor/rails/actionpack/lib/action_view/renderable.rb:39:in `render'
vendor/rails/actionpack/lib/action_view/template.rb:73:in `render_template'
vendor/rails/actionpack/lib/action_view/base.rb:256:in `render'
vendor/rails/actionpack/lib/action_view/base.rb:369:in `_render_with_layout'
vendor/rails/actionpack/lib/action_view/base.rb:254:in `render'
vendor/rails/actionpack/lib/action_controller/base.rb:1177:in `render_for_file'
vendor/rails/actionpack/lib/action_controller/base.rb:896:in `render_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'
vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:in `realtime'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'
vendor/rails/actionpack/lib/action_controller/base.rb:868:in `render_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'
vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:in `realtime'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'
vendor/rails/actionpack/lib/action_controller/base.rb:1251:in `default_render'
vendor/rails/actionpack/lib/action_controller/base.rb:1257:in `perform_action_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:638
vendor/rails/actionpack/lib/action_controller/filters.rb:189:in `call'
vendor/rails/actionpack/lib/action_controller/filters.rb:189:in `call'
vendor/rails/actionpack/lib/action_controller/filters.rb:635:in `run_before_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:615:in `call_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:136:in `passenger_orig_perform_action'
/usr/lib/ruby/1.8/phusion_passenger/railz/request_handler.rb:65:in `perform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:524:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:524:in `process_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process_without_session_management_support'
vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in `process_without_test'
vendor/rails/actionpack/lib/action_controller/test_process.rb:18:in `process'
vendor/rails/actionpack/lib/action_controller/base.rb:392:in `process'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:184:in `handle_request'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:112:in `dispatch_unlocked'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:125:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:124:in `synchronize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:124:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:134:in `dispatch_cgi'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:41:in `dispatch'
/usr/lib/ruby/1.8/phusion_passenger/railz/request_handler.rb:50:in `process_request'
/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:374:in `start_request_handler'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:332:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:330:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:209:in `start'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/phusion_passenger/passenger-spawn-server:61
Rendering /usr/share/redmine/public/500.html (500 Internal Server Error)
非常感谢任何帮助。感谢
答案 0 :(得分:2)
在你的email.yml中试试这个:
production:
delivery_method: :sendmail
或
production:
delivery_method: :smtp
并注释掉其他所有内容。
答案 1 :(得分:0)
该配置不应该在configuration.yml中,而不是在email.yml中吗? Redmine Email Configuration