Redmine发送邮件两次

时间:2013-02-21 10:01:54

标签: ruby-on-rails ruby actionmailer redmine qmail

在redmine中创建/编辑问题时,通知邮件会被发送两次。为什么呢?

我查看了redmine配置文件“config / configuration.yml”并尝试删除“production:”中的“email_delivery:”部分,因为已经在“default:”中定义了一个

即使使用“管理>设置>电子邮件通知”的“发送测试邮件”功能,测试电子邮件也会被发送两次。

但这只在使用下面的“:sendmail”配置时才会发生。使用“:smtp”并设置SMTP服务器时,邮件只能正确发送一次。使用命令行“mail”命令时,邮件也只发送一次。

这就是我的configuration.yml的样子:

production:
  email_delivery:
    delivery_method: :sendmail
# ... comments ...
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :sendmail
# ... other stuff

使用的邮件是qmail。这是mail.info的输出,用于发送测试邮件:

Feb 21 10:52:56 admin qmail-queue-handlers[12443]: Handlers Filter before-queue for qmail started ...
Feb 21 10:52:56 admin qmail-queue-handlers[12443]: from=support@web-consulting.at
Feb 21 10:52:56 admin qmail-queue-handlers[12443]: to=kraft@web-consulting.at
Feb 21 10:52:56 admin qmail-queue-handlers[12443]: to=kraft@web-consulting.at
Feb 21 10:52:56 admin qmail: 1361440376.142458 new msg 5758988
Feb 21 10:52:56 admin qmail: 1361440376.142504 info msg 5758988: bytes 2348 from <support@web-consulting.at> qp 12446 uid 10028
Feb 21 10:52:56 admin qmail: 1361440376.143705 starting delivery 34398: msg 5758988 to local 78-kraft@web-consulting.at
Feb 21 10:52:56 admin qmail: 1361440376.143730 status: local 1/10 remote 0/20
Feb 21 10:52:56 admin qmail: 1361440376.143735 starting delivery 34399: msg 5758988 to local 78-kraft@web-consulting.at
Feb 21 10:52:56 admin qmail: 1361440376.143738 status: local 2/10 remote 0/20
Feb 21 10:52:56 admin qmail-local-handlers[12447]: Handlers Filter before-local for qmail started ...
Feb 21 10:52:56 admin qmail-local-handlers[12448]: Handlers Filter before-local for qmail started ...
Feb 21 10:52:56 admin qmail-local-handlers[12448]: from=support@web-consulting.at
Feb 21 10:52:56 admin qmail-local-handlers[12448]: to=kraft@web-consulting.at
Feb 21 10:52:56 admin qmail-local-handlers[12448]: mailbox: /var/qmail/mailnames/web-consulting.at/kraft
Feb 21 10:52:56 admin qmail-local-handlers[12447]: from=support@web-consulting.at
Feb 21 10:52:56 admin qmail-local-handlers[12447]: to=kraft@web-consulting.at
Feb 21 10:52:56 admin qmail-local-handlers[12447]: mailbox: /var/qmail/mailnames/web-consulting.at/kraft
Feb 21 10:52:56 admin qmail: 1361440376.159507 delivery 34399: success: did_0+0+2/
Feb 21 10:52:56 admin qmail: 1361440376.159542 status: local 1/10 remote 0/20
Feb 21 10:52:56 admin qmail: 1361440376.160164 delivery 34398: success: did_0+0+2/
Feb 21 10:52:56 admin qmail: 1361440376.160248 status: local 0/10 remote 0/20
Feb 21 10:52:56 admin qmail: 1361440376.160283 end msg 5758988

似乎ruby ActionMailer已经两次造成“to=kraft@web-consulting.at”。

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

也许您有旧版本的sendmail?

  config.action_mailer.delivery_method = :sendmail
  config.action_mailer.sendmail_settings = {
   :location => '/usr/sbin/sendmail',
   :arguments => "-i"
  }

对我来说,我必须使用sendmail和-i来修复双重发送问题

(参考) http://stefanwienert.net/blog/2011/11/17/rails-schickt-mails-zweimal-wenn-man-sendmail-verwendet-slash-rails-sent-mails-twice-when-using-sendmail/