0

该错误似乎非常不具描述性:

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

我认为这不是真正的问题,因为即使我设置了默认值,我也尝试指定“来自”。此外,localhost 和 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 回答