File: message_id_field.rb [mail-2.6.3 Documentation]

Last Modified
  2015-06-07 16:29:12 +0000
Requires
  - mail/fields/common/common_message_id

## Description

# Message-ID Field

The Message-ID field inherits from StructuredField and handles the Message-ID: header field in the email.

Sending message_id to a mail message will instantiate a Mail::Field object that has a MessageIdField as its field type. This includes all Mail::CommonMessageId module instance metods.

Only one MessageId field can appear in a header, and syntactically it can only have one Message ID. The message_ids method call has been left in however as it will only return the one message id, ie, an array of length 1.

Note that, the message_ids method will return an array of message IDs without the enclosing angle brackets which per RFC are not syntactically part of the message id.

## Examples:

    mail = Mail.new
    mail.message_id = '<F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom>'
    mail.message_id    #=> '<F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom>'
    mail[:message_id]  #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::MessageIdField:0x180e1c4
    mail['message_id'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::MessageIdField:0x180e1c4
    mail['Message-ID'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::MessageIdField:0x180e1c4

    mail[:message_id].message_id   #=> 'F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom'
    mail[:message_id].message_ids  #=> ['F6E2D0B4-CC35-4A91-BA4C-C7C712B10C13@test.me.dom']