0

The error seems to be very non-descriptive:

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

I think this is not the real problem since I've tried specifying "from" even though I set a default. Also, the code is identical for localhost and 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 => "realaddressishereonmymachine@ourdomain.com")
end
4

2 に答える 2

2

メソッドがメソッドから呼び出されなかったfailed with ArgumentError: A sender (Return-Path, Sender or From) required to send a message場合、エラーが発生する可能性があります。mailinvite_dealer

したがって、メソッドを呼び出す前に条件returnをメソッドに入れるのは悪い考えです。invite_dealermail

于 2012-07-04T11:56:10.553 に答える
0

この行を development.rb に追加すると修正されたようです - 他のすべてのメールメソッドが機能していたのは奇妙です:

Rails.application.routes.default_url_options[:host]= 'localhost:3000'
于 2012-06-28T00:12:16.787 に答える