module MIME::Headers::Internet

The RFC 2822 Internet message header fields.

Mailbox fields to, from, cc, bcc, and reply_to may be a single email address, an array of email addresses, or a hash of email => name pairs. When using a hash, set name to nil to omit email display name. The sender field is a special case and can only contain a single mailbox.

Constants

ATOM

Internet message character specifications (RFC 5322)

DOT_ATOM
SPECIALS

Attributes

bcc[R]
cc[R]
comments[R]
date[R]
from[R]
in_reply_to[R]
keywords[R]
message_id[R]
references[R]
reply_to[R]
sender[R]
subject[R]
to[R]

Public Instance Methods

bcc=(mailbox) click to toggle source

Mailbox(es) of recipients of the message whose addresses are not to be revealed to other recipients of the message; “Blind Carbon Copy.”

# File lib/mime/headers/internet.rb, line 93
def bcc= mailbox
  @bcc = mailbox
  headers.set('Bcc', stringify_mailbox(mailbox))
end
cc=(mailbox) click to toggle source

Mailbox(es) of others who are to receive the message, though the content of the message may not be directed at them; “Carbon Copy.”

# File lib/mime/headers/internet.rb, line 84
def cc= mailbox
  @cc = mailbox
  headers.set('Cc', stringify_mailbox(mailbox))
end
comments=(comments) click to toggle source

Additional comments about the message content.

# File lib/mime/headers/internet.rb, line 140
def comments= comments
  @comments = comments
  headers.set('Comments', comments)
end
date=(date) click to toggle source

Origination date at which the creator of the message indicated that the message was complete and ready to enter the mail delivery system.

# File lib/mime/headers/internet.rb, line 42
def date= date
  @date = date
  headers.set('Date', date.rfc2822)
end
from=(mailbox) click to toggle source

Person(s) or system(s) responsible for writing the message.

# File lib/mime/headers/internet.rb, line 50
def from= mailbox
  @from = mailbox
  headers.set('From', stringify_mailbox(mailbox))
end
in_reply_to=(id) click to toggle source

The id of the message to which this message is a reply.

# File lib/mime/headers/internet.rb, line 122
def in_reply_to= id
  @in_reply_to = id
  headers.set('In-Reply-To', "<#{id}>")
end
keywords=(keywords) click to toggle source

Comma-separated list of important words and phrases that might be useful for the recipient.

# File lib/mime/headers/internet.rb, line 149
def keywords= keywords
  @keywords = keywords
  headers.set('Keywords', keywords)
end
message_id=(id) click to toggle source

Globally unique identifier of the message.

The message id must contain an embedded “@” symbol. An example id might be some-unique-id@domain.com.

# File lib/mime/headers/internet.rb, line 112
def message_id= id
  @message_id = id
  headers.set('Message-ID', "<#{id}>")
end
references=(id) click to toggle source

The id used to identify a “thread” of conversation.

# File lib/mime/headers/internet.rb, line 132
def references= id
  @references = id
  headers.set('References', "<#{id}>")
end
reply_to=(mailbox) click to toggle source

Mailbox(es) to which the author suggests that replies be sent.

# File lib/mime/headers/internet.rb, line 101
def reply_to= mailbox
  @reply_to = mailbox
  headers.set('Reply-To', stringify_mailbox(mailbox))
end
sender=(mailbox) click to toggle source

Mailbox of the agent responsible for actual transmission of the message. Sender field is required if the From field contains multiple mailboxes.

Example scenario

If a secretary were to send a message for another person, the mailbox of the secretary would appear in the Sender field and the mailbox of the actual author would appear in the From field.

# File lib/mime/headers/internet.rb, line 64
def sender= mailbox
  if (mailbox.is_a?(Hash) || mailbox.is_a?(Array)) && mailbox.size != 1
    raise ArgumentError, '"Sender" must be a single mailbox specification'
  end
  @sender = mailbox
  headers.set('Sender', stringify_mailbox(mailbox))
end
subject=(subject) click to toggle source

The message topic.

# File lib/mime/headers/internet.rb, line 157
def subject= subject
  @subject = subject
  headers.set('Subject', subject)
end
to=(mailbox) click to toggle source

Mailbox(es) of the primary recipient(s).

# File lib/mime/headers/internet.rb, line 75
def to= mailbox
  @to = mailbox
  headers.set('To', stringify_mailbox(mailbox))
end