2012-06-27 178 views
0

錯誤似乎是非常非描述:ActionMailer的郵件方法適用於Heroku,但不適用於本地主機?

failed with ArgumentError: A sender (Return-Path, Sender or From) required to send a message 

我覺得這不是真正的問題,因爲我已經試過「從」即使我設置默認指定。此外,該代碼是本地主機和Heroku的相同...

def invite_dealer(auction, name, email, dealer) 
    return false if dealer.bids.where("auction_id = ?", auction.id).present? 
    @name = name #used on template 
    @email = email 
    @auction = auction #this too 
    mail(:to => @email, :subject => "New Auction - #{auction.car.name}", :from => "[email protected]") 
end 
+0

PS我正在使用的所有其他郵件延遲都可以正常使用。 – davecom

回答

2

的如果mail方法未從invite_dealer方法中調用,則可能發生錯誤failed with ArgumentError: A sender (Return-Path, Sender or From) required to send a message

所以把條件returninvite_dealer方法之前調用mail方法是壞主意。

+0

這正是問題所在,你不能從郵件方式「退貨」來短路交貨。您需要將邏輯設置爲不在相關郵件程序外調用郵件程序。 –

0

加入這行來development.rb似乎已經解決了 - 奇怪的所有其他郵件方法進行工作:

Rails.application.routes.default_url_options[:host]= 'localhost:3000' 
相關問題