如何定义回复地址?


Answers:


145

两种方式:

class Notifications < ActionMailer::Base
  default :from     => 'your_app@your_domain.com',
          :reply_to => 'some_other_address@your_domain.com'
end

要么:

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

或者,您可以将两种方法混合使用。我敢肯定,还有更多的方法可以做到这一点。


4
傻孩子,除了邮件方法定义,我到处都看过:apidock.com/rails/ActionMailer/Base/mail谢谢!
emzero

官方的文档显示这个太:api.rubyonrails.org/classes/ActionMailer/...
user664833

1
根据此信息:igvita.com/2007/07/21/sendmail-spam-filter-tricks-in-rails它们应该匹配,否则您的邮件将被垃圾邮件软件标记。
丹·巴伦

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.