看起來像我的電子郵件引發錯誤和發送。ActionMailer發送電子郵件,即使它與ArgumentError失敗:發件人需要發送消息
我收到的電子郵件,也是我得到這個錯誤「耙作業:工作」控制檯:
Class#deliver_and_save failed with ArgumentError: A sender (Return-Path, Sender or From) required to send a message - 1 failed attempts
但是當我通過我的調試步驟,我可以看到,有是一個from
:
> email.from
=> ["[email protected]"]
> email_draft.From
=> Me <[email protected]>
> email_draft.sender
=> nil
> email_draft.Sender
=> nil
> email_draft.reply_to
=> ["[email protected]"]
是否有可能ActionMailer拋出錯誤,仍然發送?這是一個已知的問題?我遇到的問題是,delayed_job不斷重複發送電子郵件。
UPDATE:
def EmailEngine < ActionMailer::Base
# Called with EmailEngine.delay.deliver_and_save(template)
def deliver_and_save(template)
# This appears to be raising the error
email_draft = EmailEngine.send(template) # this will invoke 'mail'
# Saved here to have a better record than the logs provide
Email.create(...
# Yet this still sends
email_draft.deliver
順便說一句,我找到了一個解決方法,以及:只調用delayed_job的的「延遲」的方法對一類不*不* FROM的ActionMailer繼承和然後從那裏調用你的ActionMailer方法。這就像通過代理方法調用ActionMailer的延遲,並且工作得很好。 – thewillcole 2012-02-29 09:21:20