【发布时间】:2011-02-21 05:20:52
【问题描述】:
我在开发模式下使用 Ruby 1.9.2 和 Rails 3.0.4,我正在尝试将其配置为从安装在同一个盒子上的 Postfix 服务器发送电子邮件(运行 Ubuntu 10.04 并安装了 dovecot-postfix 包) 每当我尝试从 Rails 发送电子邮件时,它都会在 Rails 中顺利通过,但在 Postfix 日志中显示错误(我已从下面的摘录中删除了域和 IP):
Feb 21 04:49:16 alpha postfix/smtpd[9060]: connect from alpha.mydomain.com[xxx.xxx.xxx.xxx]
Feb 21 04:49:16 alpha postfix/smtpd[9060]: lost connection after STARTTLS from alpha.mydomain.com[xxx.xxx.xxx.xxx]
Feb 21 04:49:16 alpha postfix/smtpd[9060]: disconnect from alpha.mydomain.com[xxx.xxx.xxx.xxx]
奇怪的是,当我从 Thunderbird 等电子邮件客户端连接到 SMTP 服务器时,它可以正常工作。
我知道开发模式有时不允许发送电子邮件,所以我在 environment/development.rb 文件中添加了以下内容:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
#load mail server settings
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "mail.mydomain.com",
:port => 587,
:domain => 'mydomain.com',
:user_name => 'username',
:password => 'password',
:authentication => 'plain',
:tls => true,
:enable_starttls_auto => true }
【问题讨论】:
-
我做了更多的挖掘工作并在 Postfix 日志中启用了更详细的信息。我现在看到显示“503 5.5.1 错误:身份验证未启用”的日志,但我在后缀配置中启用了 SASL
标签: email ruby-on-rails-3 actionmailer postfix-mta