如何定义回复地址?

emz*_*ero 84 actionmailer ruby-on-rails-3

如何定义不同于该地址的回复地址:from?这甚至可能吗?

dog*_*unk 138

两种方式:

class Notifications < ActionMailer::Base
  default :from     => 'your_app@your_domain.com',
          :reply_to => 'some_other_address@your_domain.com'
end
Run Code Online (Sandbox Code Playgroud)

要么:

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
Run Code Online (Sandbox Code Playgroud)

或者你可以混合使用这两种方法.我相信还有更多方法可以做到这一点.

  • 傻孩子,我到处都看了但邮件方法的定义:http://apidock.com/rails/ActionMailer/Base/mail谢谢! (4认同)