NAME
Mail::Internet - manipulate Internet format (RFC 822) mail messages
SYNOPSIS
use Mail::Internet;
DESCRIPTION
This package provides a class object which can be used for reading, creating, manipulating and writing a message with RFC822 compliant headers.
CONSTRUCTOR
- new ( [ ARG ], [ OPTIONS ] )
-
ARGis optiona and may be either a file descriptor (reference to a GLOB) or a reference to an array. If given the new object will be initialized with headers either from the array of read from the file descriptor.OPTIONSis a list of options given in the form of key-value pairs, just like a hash table. Valid options are- Header
-
The value of this option should be a
Mail::Headerobject. If given thenMail::Internetwill not attempt to read a mail header fromARG, if it was specified. - Body
-
The value of this option should be a reference to an array which contains the lines for the body of the message. If given then
Mail::Internetwill not attempt to read the body fromARG, if it was specified.
The Mail::Header options
Modify,MailFromandFoldLengthmay also be given.
METHODS
- body ()
-
Returns the body of the message. This is a reference to an array. Each entry in the array represents a single line in the message.
- print_header ( [ FILEHANDLE ] )
- print_body ( [ FILEHANDLE ] )
- print ( [ FILEHANDLE ] )
-
Print the header, body or whole message to file descriptor FILEHANDLE. $fd should be a reference to a GLOB. If FILEHANDLE is not given the output will be sent to STDOUT.
$mail->print( \*STDOUT ); # Print message to STDOUT - head ()
-
Returns the
Mail::Headerobject which holds the headers for the current message
UTILITY METHODS
The following methods are more a utility type than a manipulation type of method.
- remove_sig ( [ NLINES ] )
-
Attempts to remove a users signature from the body of a message. It does this by looking for a line equal to
'-- 'within the lastNLINESof the message. If found then that line and all lines after it will be removed. IfNLINESis not given a default value of 10 will be used. This would be of most use in auto-reply scripts. - tidy_body ()
-
Removes all leading and trailing lines from the body that only contain white spaces.
-
Create a new object with header initialised for a reply to the current object. And the body will be a copy of the current message indented.
- add_signature ( [ FILE ] )
-
Append a signature to the message.
FILEis a file which contains the signature, if not given then the file "$ENV{HOME}/.signature" will be checked for. - smtpsend ()
-
Send a Mail::Internet message via SMTP
The message will be sent to all addresses on the To, Cc and Bcc lines. The SMTP host is found by attempting connections first to hosts specified in
$ENV{SMTPHOSTS}, a colon separated list, thenmailhostandlocalhost. - nntppost ()
-
Post an article via NNTP, require News::NNTPClient.
- escape_from ()
-
It can cause problems with some applications if a message contains a line starting with
`From ', in particular when attempting to split a folder. This method inserts a leading`'> on anyline starting with`From ' - unescape_from ()
-
This method will remove the escaping added bu escape_from
SEE ALSO
AUTHOR
Graham Barr <gbarr@ti.com>
COPYRIGHT
Copyright (c) 1995 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.