The Email:: namespace was begun as a reaction against the increasing complexity and bugginess of Perl's existing email modules. Email::* modules are meant to be simple to use and to maintain, pared to the bone, fast, minimal in their external dependencies, and correct.

This method parses an email from a scalar containing an RFC2822 formatted message and returns an object. $message may be a reference to a message string, in which case the string will be altered in place. This can result in significant memory savings.

If you want to create a message from scratch, you should use the "create" method.

Valid arguments are:

header_class - the class used to create new header objects
The named module is not 'require'-ed by Email::Simple!

This method is a constructor that creates an Email::Simple object from a set of named parameters. The header parameter's value is a list reference containing a set of headers to be created. The body parameter's value is a scalar value holding the contents of the message body. Line endings in the body will normalized to CRLF.

If no Date header is specified, one will be provided for you based on the gmtime of the local machine. This is because the Date field is a required header and is a pain in the neck to create manually for every message. The From field is also a required header, but it is not provided for you.

In list context, this returns every value for the named header. In scalar context, it returns the first value for the named header. If second parameter is specified then instead first value it returns value at position $index (negative $index is from the end).

Sets the header to contain the given data. If you pass multiple lines in, you get multiple headers, and order is retained. If no values are given to set, the header will be removed from to the message entirely.

This method returns the list of header names currently in the email object. These names can be passed to the header method one-at-a-time to get header values. You are guaranteed to get a set of headers that are unique. You are not guaranteed to get the headers in any order at all.

For backwards compatibility, this method can also be called as headers.

Email::Simple handles only RFC2822 formatted messages. This means you cannot expect it to cope well as the only parser between you and the outside world, say for example when writing a mail filter for invocation from a .forward file (for this we recommend you use Email::Filter anyway).