SYNOPSIS

 my $head = Mail::Message::Head->new;
 $head->add('From: me@localhost');
 $head->add(From => 'me@localhost');
 $head->add(Mail::Message::Field->new(From => 'me'));
 my Mail::Message::Field $subject = $head->get('subject');
 my Mail::Message::Field @rec = $head->get('received');
 $head->delete('From');

See SYNOPSIS in Mail::Reporter

DESCRIPTION

Mail::Message::Head MIME headers are part of Mail::Message messages, which are grouped in Mail::Box folders.

ATTENTION!!! most functionality about e-mail headers is described in Mail::Message::Head::Complete, which is a matured header object. Other kinds of headers will be translated to that type when time comes.

On this page, the general methods which are available on any header are described. Read about differences in the sub-class specific pages.

See DESCRIPTION in Mail::Reporter

DETAILS

Ordered header fields

Many Perl implementations make a big mistake by disturbing the order of header fields. For some fields (especially the resent groups, see Mail::Message::Head::ResentGroup) the order shall be maintained.

MailBox will keep the order of the fields as they were found in the source. When your add a new field, it will be added at the end. If your replace a field with a new value, it will stay in the original order.

Head class implementation

The header of a MIME message object contains a set of lines, which are called fields (by default represented by Mail::Message::Field objects). Dependent on the situation, the knowledge about the fields can be in one of three situations, each represented by a sub-class of this module:

Subsets of header fields

Message headers can be quite large, and therefore MailBox provides simplified access to some subsets of information. You can grab these sets of fields together, create and delete them as group.

On the moment, the following sets are defined: