class RMail::Header

Overview

The RMail::Header class supports the creation and manipulation of RFC2822 mail headers.

A mail header is a little bit like a Hash. The fields are keyed by a string field name. It is also a little bit like an Array, since the fields are in a specific order. This class provides many of the methods of both the Hash and Array class. It also includes the Enumerable module.

Terminology

header

The entire header. Each RMail::Header object is one mail header.

field

An element of the header. Fields have a name and a value. For example, the field “Subject: Hi Mom!” has a name of “Subject” and a value of “Hi Mom!”

name

A name of a field. For example: “Subject” or “From”.

value

The value of a field.

Conventions

The header’s fields are stored in a particular order. Methods such as each process the headers in this order.

When field names or values are added to the object they are frozen. This helps prevent accidental modification to what is stored in the object.