我如何定义一个不同于 :from的回复地址? 这可能吗?
:from
Two ways:
class Notifications < ActionMailer::Base default :from => 'your_app@your_domain.com', :reply_to => 'some_other_address@your_domain.com' end
Or:
class Contacts < ActionMailer::Base def new_contact mail( :to => 'somebody@some_domain.com', :from => 'your_app@your_domain.com', :reply_to => 'someone_else@some_other_domain.com') end end
Or you can mix the two approaches. I'm sure there are even more ways to do this.
Solution for Rails 5.2 and possibly older/newer versions:
Amend the file:
config/environments/development.rb
With content:
Rails.application.configure do config.action_mailer.default_options = { reply_to: 'test@example.com' } end
The reference:
https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration