我正在尝试在Ubuntu 12.04上设置Redmine,除了电子邮件通知外,一切正常。
我正在使用带有最新更新的Ubuntu 12.04 LTS,从PPA存储库安装了Ruby和Redmine。机器在VMWare虚拟机中运行。
$ ruby -v
ruby 1.9.3p448 (2013-06-27) [x86_64-linux] Brightbox
$ rails -v
Rails 3.2.13
$ apt-cache policy redmine
redmine:
Installed: 2.3.3-2+debphp.org~precise+2
Candidate: 2.3.3-2+debphp.org~precise+2
Version table:
*** 2.3.3-2+debphp.org~precise+2 0
500 http://ppa.launchpad.net/ondrej/redmine/ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
1.3.2+dfsg1-1ubuntu1 0
500 http://cn.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
所以我使用Ruby 1.9.3p448和Rails 3.2.13以及Redmine 2.3.3
我按照Redmine的指南,在config/configuration.yml
中设置SMTP设置,如下所示:
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: "smtp.exmail.qq.com"
port: 25
authentication: :plain
domain: "domain.com"
user_name: "redmine@domain.com"
password: "pwd"
当我点击“发送测试邮件”时,会弹出此错误:
An error occurred while sending mail (Connection refused - connect(2))
我确信我可以连接到SMTP服务器,因为我已成功发送了一封带有PLAIN
身份验证方法的telnet电子邮件。登录名和密码也会签出。我也尝试将配置置于默认,生产,开发的各种组合中,它只是不起作用。
我一直试图解决这个问题好几天,我是Ruby / Rails的新手,所以我很无能为力。
我尝试打开详细日志记录并在发送测试电子邮件时查看日志,但没有显示任何有用信息。日志有点太长了所以我要把它贴在pastebin中。 http://pastebin.com/yaN0Jhyt
我还尝试使用TLS / SSL并尝试添加enable_starttls_auto: true/false
,ssl: true/false
等选项(当然还要更改为正确的加密端口),没有任何帮助。
某些版本的Ruby或ActionMailer gem可能会影响这个吗?我按照Redmine网站上的安装指南写了这封信,但我仍有这个问题。
FWIW,这是我尝试通过Rails控制台发送邮件时的日志:
Errno::ECONNREFUSED: Connection refused - connect(2)
from /usr/lib/ruby/1.9.1/net/smtp.rb:540:in `initialize'
from /usr/lib/ruby/1.9.1/net/smtp.rb:540:in `open'
from /usr/lib/ruby/1.9.1/net/smtp.rb:540:in `tcp_socket'
from /usr/lib/ruby/1.9.1/net/smtp.rb:549:in `block in do_start'
from /usr/lib/ruby/1.9.1/timeout.rb:69:in `timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
from /usr/lib/ruby/1.9.1/net/smtp.rb:549:in `do_start'
from /usr/lib/ruby/1.9.1/net/smtp.rb:519:in `start'
from /usr/lib/ruby/vendor_ruby/mail/network/delivery_methods/smtp.rb:144:in `deliver!'
from /usr/lib/ruby/vendor_ruby/mail/message.rb:2034:in `do_delivery'
from /usr/lib/ruby/vendor_ruby/mail/message.rb:229:in `block in deliver'
from /usr/lib/ruby/vendor_ruby/action_mailer/base.rb:415:in `block in deliver_mail'
from /usr/lib/ruby/vendor_ruby/active_support/notifications.rb:123:in `block in instrument'
from /usr/lib/ruby/vendor_ruby/active_support/notifications/instrumenter.rb:20:in `instrument'
from /usr/lib/ruby/vendor_ruby/active_support/notifications.rb:123:in `instrument'
from /usr/lib/ruby/vendor_ruby/action_mailer/base.rb:413:in `deliver_mail'
from /usr/lib/ruby/vendor_ruby/mail/message.rb:229:in `deliver'
from (irb):17
from /usr/lib/ruby/vendor_ruby/rails/commands/console.rb:47:in `start'
from /usr/lib/ruby/vendor_ruby/rails/commands/console.rb:8:in `start'
from /usr/lib/ruby/vendor_ruby/rails/commands.rb:41:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from script/rails:6:in `<main>'
非常感谢您的帮助!