1Mail::Internet(3)     User Contributed Perl Documentation    Mail::Internet(3)
2
3
4

NAME

6       Mail::Internet - manipulate Internet format (RFC 822) mail messages
7

SYNOPSIS

9           use Mail::Internet;
10

DESCRIPTION

12       This package provides a class object which can be used for reading,
13       creating, manipulating and writing a message with RFC822 compliant
14       headers.
15
16       If you start writing a new application, you may want to use the
17       Mail::Box set of packages (requires perl 5.6.1), which has more fea‐
18       tures and handles modern messages much better.  See <http://perl.over
19       meer.net/mailbox/>.
20

CONSTRUCTOR

22       new ( [ ARG ], [ OPTIONS ] )
23           "ARG" is optional and may be either a file descriptor (reference to
24           a GLOB) or a reference to an array. If given the new object will be
25           initialized with headers and body either from the array of read
26           from the file descriptor.
27
28           "OPTIONS" is a list of options given in the form of key-value
29           pairs, just like a hash table. Valid options are
30
31           Header  The value of this option should be a "Mail::Header" object.
32                   If given then "Mail::Internet" will not attempt to read a
33                   mail header from "ARG", if it was specified.
34
35           Body    The value of this option should be a reference to an array
36                   which contains the lines for the body of the message. Each
37                   line should be terminated with "\n" (LF). If Body is given
38                   then "Mail::Internet" will not attempt to read the body
39                   from "ARG" (even if it is specified).
40
41           The Mail::Header options "Modify", "MailFrom" and "FoldLength" may
42           also be given.
43

METHODS

45       body ( [ BODY ] )
46           Returns the body of the message. This is a reference to an array.
47           Each entry in the array represents a single line in the message.
48
49           If BODY is given, it can be a reference to an array or an array,
50           then the body will be replaced. If a reference is passed, it is
51           used directly and not copied, so any subsequent changes to the
52           array will change the contents of the body.
53
54       print_header ( [ FILEHANDLE ] )
55       print_body ( [ FILEHANDLE ] )
56       print ( [ FILEHANDLE ] )
57           Print the header, body or whole message to file descriptor FILEHAN‐
58           DLE.  $fd should be a reference to a GLOB. If FILEHANDLE is not
59           given the output will be sent to STDOUT.
60
61               $mail->print( \*STDOUT );  # Print message to STDOUT
62
63       as_string ()
64           Returns the message as a single string.
65
66       as_mbox_string ( [ ALREADY_ESCAPED ] )
67           Returns the message as a string in mbox format.  "ALREADY_ESCAPED",
68           if given and true, indicates that ->escape_from has already been
69           called on this object.
70
71       head ()
72           Returns the "Mail::Header" object which holds the headers for the
73           current message
74

UTILITY METHODS

76       The following methods are more a utility type than a manipulation type
77       of method.
78
79       remove_sig ( [ NLINES ] )
80           Attempts to remove a users signature from the body of a message. It
81           does this by looking for a line equal to '-- ' within the last
82           "NLINES" of the message. If found then that line and all lines
83           after it will be removed. If "NLINES" is not given a default value
84           of 10 will be used. This would be of most use in auto-reply
85           scripts.
86
87       tidy_body ()
88           Removes all leading and trailing lines from the body that only con‐
89           tain white spaces.
90
91       reply ()
92           Create a new object with header initialised for a reply to the cur‐
93           rent object. And the body will be a copy of the current message
94           indented.
95
96       add_signature ( [ FILE ] )
97           Append a signature to the message. "FILE" is a file which contains
98           the signature, if not given then the file "$ENV{HOME}/.signature"
99           will be checked for.
100
101       send ( [ type [ args.. ]] )
102           Send a Mail::Internet message using Mail::Mailer.  Type and args
103           are passed on to "Mail::Mailer"
104
105       smtpsend ( [ OPTIONS ] )
106           Send a Mail::Internet message via SMTP, requires Net::SMTP
107
108           The return value will be a list of email addresses that the message
109           was sent to. If the message was not sent the list will be empty.
110
111           Options are passed as key-value pairs. Current options are
112
113           Host
114               Name of the SMTP server to connect to, or a Net::SMTP object to
115               use
116
117               If "Host" is not given then the SMTP host is found by attempt‐
118               ing connections first to hosts specified in $ENV{SMTPHOSTS}, a
119               colon separated list, then "mailhost" and "localhost".
120
121           MailFrom
122               The e-mail address which is used as sender.  By default, the
123               mailaddress() method provides the address of the sender.
124
125           To
126           Cc
127           Bcc Send the email to the given addresses, each can be either a
128               string or a reference to a list of email addresses. If none of
129               "To", <Cc> or "Bcc" are given then the addresses are extracted
130               from the message being sent.
131
132           Hello
133               Send a HELO (or EHLO) command to the server with the given
134               name.
135
136           Port
137               Port number to connect to on remote host
138
139           Debug
140               Debug value to pass to Net::SMPT, see <Net::SMTP>
141
142       nntppost ( [ OPTIONS ] )
143           Post an article via NNTP, requires Net::NNTP.
144
145           Options are passed as key-value pairs. Current options are
146
147           Host
148               Name of NNTP server to connect to, or a Net::NNTP object to
149               use.
150
151           Port
152               Port number to connect to on remote host
153
154           Debug
155               Debug value to pass to Net::NNTP, see <Net::NNTP>
156
157       escape_from ()
158           It can cause problems with some applications if a message contains
159           a line starting with `From ', in particular when attempting to
160           split a folder.  This method inserts a leading "`"'> on anyline
161           that matches the regular expression "/^"*From/>
162
163       unescape_from ()
164           This method will remove the escaping added by escape_from
165

SEE ALSO

167       Mail::Header Mail::Address
168

AUTHOR

170       Graham Barr.  Maintained by Mark Overmeer <mailtools@overmeer.net>
171
173       Copyright (c) 2002-2003 Mark Overmeer, 1995-2001 Graham Barr. All
174       rights reserved. This program is free software; you can redistribute it
175       and/or modify it under the same terms as Perl itself.
176
177
178
179perl v5.8.8                       2007-05-11                 Mail::Internet(3)
Impressum