table of contents
Mail::Internet(3) | User Contributed Perl Documentation | Mail::Internet(3) |
NAME¶
Mail::Internet - manipulate email messages
INHERITANCE¶
SYNOPSIS¶
use Mail::Internet; my $msg = Mail::Internet->new(\*STDIN);
DESCRIPTION¶
This package implements reading, creating, manipulating, and writing email messages. Sometimes, the implementation tries to be too smart, but in the general case it works as expected.
If you start writing a new application, you should use the Mail::Box distribution, which has more features and handles messages much better according to the RFCs. See <http://perl.overmeer.net/mailbox/>. You may also chose MIME::Entity, to get at least some multipart support in your application.
METHODS¶
Constructors¶
$obj->dup
$obj->extract(ARRAY-of-LINES)
$obj->new([ARG], [OPTIONS])
Mail::Internet->new([ARG], [OPTIONS])
The Mail::Header::new() OPTIONS "Modify", "MailFrom" and "FoldLength" may also be given.
Option--Default Body [] Header undef
. Body => ARRAY-of-LINES
. Header => Mail::Header
$obj->read(FILEHANDLE)
Accessors¶
$obj->body([BODY])
If BODY is given, it can be a reference to an array or an array, then the body will be replaced. If a reference is passed, it is used directly and not copied, so any subsequent changes to the array will change the contents of the body.
$obj->head
Processing the message as a whole¶
$obj->as_mbox_string([ALREADY_ESCAPED])
$obj->as_string
$obj->print([FILEHANDLE])
example:
$mail->print( \*STDOUT ); # Print message to STDOUT
$obj->print_body([FILEHANDLE])
$obj->print_header([FILEHANDLE])
Processing the header¶
Most of these methods are simply wrappers around methods provided by Mail::Header.
$obj->add(PAIRS-of-FIELD)
$obj->combine(TAG, [WITH])
$obj->delete(TAG, [TAGs])
$obj->fold([LENGTH])
$obj->fold_length([TAG], [LENGTH])
$obj->get(TAG, [TAGs])
$obj->header([ARRAY-of-LINES])
$obj->replace(PAIRS-of-FIELD)
Processing the body¶
$obj->remove_sig([NLINES])
$obj->sign(OPTIONS)
Option --Default File undef Signature []
. File => FILEHANDLE
. Signature => STRING|ARRAY-of-LINES
$obj->tidy_body
High-level functionality¶
$obj->escape_from
$obj->nntppost([OPTIONS])
Option--Default Debug <false> Host <required> Port 119
. Debug => BOOLEAN
. Host => HOSTNAME|Net::NNTP object
. Port => INTEGER
$obj->reply(OPTIONS)
The ".mailhdr" file in your home directory (if exists) will be read first, to provide defaults.
Option --Default Exclude [] Indent '>' Keep [] ReplyAll false
. Exclude => ARRAY-of-FIELDS
. Indent => STRING
. Keep => ARRAY-of-FIELDS
. ReplyAll => BOOLEAN
$obj->send([TYPE, [ARGS...]])
$obj->smtpsend([OPTIONS])
The return value will be a list of email addresses that the message was sent to. If the message was not sent the list will be empty.
Requires Net::SMTP and Net::Domain to be installed.
Option --Default Bcc undef Cc undef Debug <false> Hello localhost.localdomain Host $ENV{SMTPHOSTS} MailFrom Mail::Util::mailaddress() Port 25 To undef
. Bcc => ADDRESSES
. Cc => ADDRESSES
. Debug => BOOLEAN
. Hello => STRING
. Host => HOSTNAME
If "Host" is not given then the SMTP host is found by attempting connections first to hosts specified in $ENV{SMTPHOSTS}, a colon separated list, then "mailhost" and "localhost".
. MailFrom => ADDRESS
. Port => INTEGER
. To => ADDRESSES
$obj->unescape_from(())
SEE ALSO¶
This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/.
AUTHORS¶
The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development.
Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
LICENSE¶
Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark Overmeer <perl@overmeer.net>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
2008-07-29 | perl v5.10.1 |