How to define a reply-to address?

emzero picture emzero · May 5, 2011 · Viewed 23k times · Source

How can I define a reply-to address different than the :from one? Is that even possible?

Answer

dogenpunk picture dogenpunk · May 5, 2011

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.