MIME-Fast
view release on metacpan or search on metacpan
If you need to parse any message data use construct_message()
method from the MIME::Fast::Parser submodule.
Optional parameter I<pretty_headers> (default 0) if set to 1,
initializes friendly order of the header items.
The object is destroyed during the perl garbage collection.
E.g.:
my $msg = new MIME::Fast::Message;
=item I<set_sender>(address)
=item I<get_sender>()
Set and get the sender's name and address on the MIME::Fast::Message object.
E.g.
$msg->set_sender("\"Joe Sixpack\" <joe\@sixpack.org>");
$sender = $msg->get_sender;
=item I<set_reply_to>(address)
=item I<get_reply_to>(address)
Set and get the sender's Reply-To address of the MIME message.
=item I<add_recipient>(type, name, email)
Add a recipient of a chosen type to the MIME Message.
Available recipient types include: GMIME_RECIPIENT_TYPE_TO,
GMIME_RECIPIENT_TYPE_CC and GMIME_RECIPIENT_TYPE_BCC.
=item I<add_recipients_from_string>(type, string)
Add recipients of a chosen type to the MIME Message.
E.g.:
$msg->add_recipients_from_string(GMIME_RECIPIENT_TYPE_TO,
"\"Mickey Mouse\" <mickey\@example>," .
"\"John Doe\" <john\@home>");
=item I<get_recipients>(type)
Returns a list of recipients of a chosen type from the MIME Message.
The I<type> parameter is the same as in the add_recipient() method.
=item I<set_subject>(subject)
=item I<get_subject>()
Set and get the subject of the MIME message.
=item I<set_date>(date, gmt_offset)
=item I<set_date_from_string>(str)
Set the sent-date on the MIME message. You can give a date string
or the numbers (time in seconds and offset in hours and minutes).
E.g.
$msg->set_date(991697409, '+0100');
$msg->set_date("Wed, 7 Mar 2001 03:00:01 +0100 (CET)");
=item I<get_date>()
Get the sent-date of the MIME message. In scalar
context returns date as a string value,
otherwise two element array - time in seconds and gmt_offset.
=item I<set_message_id>(message_id)
=item I<get_message_id>()
Set and get the Message-Id of the message.
=item I<set_header>(field, value)
Set a message header to the MIME Message. This can be
such headers as X-Mailer, X-Priority, or In-Reply-To
as well as From etc. If you want to delete
any header - use remove_header() method.
=item I<add_header>(field, value)
Add a header to the message header.
=item I<remove_header>(field)
Removes the given field from the message header.
=item I<get_header>(field)
Get the header from the MIME message. This is the only (besides the
tied header hash) way you can retrieve any arbitrary header
(as X-Mailer etc.). Other headers can be accessed also with e.g.
get_sender (From header), get_content_type (MIME::Fast::Part method), etc.
=item I<set_mime_part>(mime_part)
=item I<get_mime_part>()
Set and get the root-level MIME part of the message.
Parameter mime_part should be valid MIME::Fast::Object object.
B<NOTE>: get_mime_part() does not exists in C gmime library.
=item I<get_body>(want_plain = 1, is_html = 0)
Returns the body of the message. Parameters are optional.
If want_plain is 1 (default) plain text is returned.
If HTML is in the return string, is_html is set to 1.
Binary parts are omitted.
=item I<get_headers>()
Returns an allocated string containing the raw message headers.
=item I<foreach_part>(function, data)
Calls callback on each of the mime parts in the mime message.
Parameters: function is the reference to the callback function,
and data is a scalar (or any reference) that would be passed
( run in 2.140 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )