Flowdock
method

headers

Importance_2
Ruby on Rails latest stable (v4.2.1) - 0 notes - Class: ActionMailer::Base
headers(args = nil) public

Allows you to pass random and unusual headers to the new Mail::Message object which will add them to itself.

headers['X-Special-Domain-Specific-Header'] = "SecretValue"

You can also pass a hash into headers of header field names and values, which will then be set on the Mail::Message object:

headers 'X-Special-Domain-Specific-Header' => "SecretValue",
        'In-Reply-To' => incoming.message_id

The resulting Mail::Message will have the following in its header:

X-Special-Domain-Specific-Header: SecretValue

Note about replacing already defined headers:

  • subject

  • sender

  • from

  • to

  • cc

  • bcc

  • reply-to

  • orig-date

  • message-id

  • references

Fields can only appear once in email headers while other fields such as X-Anything can appear multiple times.

If you want to replace any header which already exists, first set it to nil in order to reset the value otherwise another field will be added for the same header.

Show source
Register or log in to add new notes.