Email::Abstract - Unified interface to mail representations
my $message = Mail::Message->read($rfc822) || Email::Simple->new($rfc822) || Mail::Internet->new([split /\n/, $rfc822]) || ...; my $subject = Email::Abstract->get_header($message, "Subject"); Email::Abstract->set_header($message, "Subject", "My new subject"); my $body = Email::Abstract->get_body($message); Email::Abstract->set_body($message, "Hello\nTest message\n"); $rfc822 = Email::Abstract->as_string($message); my $mail_message = Email::Abstract->cast($message, "Mail::Message");
Email::Abstract provides module writers with the ability to write representation-independent mail handling code. For instance, in the cases of Mail::Thread or Mail::ListDetector, a key part of the code involves reading the headers from a mail object. Where previously one would either have to specify the mail class required, or to build a new object from scratch, Email::Abstract can be used to perform certain simple operations on an object regardless of its underlying representation.
Email::Abstract
Mail::Thread
Mail::ListDetector
Email::Abstract currently supports Mail::Internet, MIME::Entity, Mail::Message, Email::Simple and Email::MIME. Other representations are encouraged to create their own Email::Abstract::* class by copying Email::Abstract::EmailSimple. All modules installed under the Email::Abstract hierarchy will be automatically picked up and used.
Mail::Internet
MIME::Entity
Mail::Message
Email::Simple
Email::MIME
Email::Abstract::*
Email::Abstract::EmailSimple
This returns the value or list of values of the given header.
This sets the $header header to the given one or more values.
$header
This returns the body as a string.
This changes the body of the email to the given string.
This returns the whole email as a string.
Casey West, <casey@geeknest.com>
Simon Cozens, <simon@cpan.org>
Copyright 2004 by Simon Cozens
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://pep.kwiki.org
To install Email::Abstract, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Email::Abstract
CPAN shell
perl -MCPAN -e shell install Email::Abstract
For more information on module installation, please visit the detailed CPAN module installation guide.