.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Mail::Internet 3" .TH Mail::Internet 3 "2007-05-11" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Mail::Internet \- manipulate Internet format (RFC 822) mail messages .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Mail::Internet; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This package provides a class object which can be used for reading, creating, manipulating and writing a message with \s-1RFC822\s0 compliant headers. .PP If you start writing a \fBnew application\fR, you may want to use the Mail::Box set of packages (requires perl 5.6.1), which has more features and handles modern messages much better. See . .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .IP "new ( [ \s-1ARG\s0 ], [ \s-1OPTIONS\s0 ] )" 4 .IX Item "new ( [ ARG ], [ OPTIONS ] )" \&\f(CW\*(C`ARG\*(C'\fR is optional and may be either a file descriptor (reference to a \s-1GLOB\s0) or a reference to an array. If given the new object will be initialized with headers and body either from the array of read from the file descriptor. .Sp \&\f(CW\*(C`OPTIONS\*(C'\fR is a list of options given in the form of key-value pairs, just like a hash table. Valid options are .RS 4 .IP "\fBHeader\fR" 8 .IX Item "Header" The value of this option should be a \f(CW\*(C`Mail::Header\*(C'\fR object. If given then \&\f(CW\*(C`Mail::Internet\*(C'\fR will not attempt to read a mail header from \f(CW\*(C`ARG\*(C'\fR, if it was specified. .IP "\fBBody\fR" 8 .IX Item "Body" The value of this option should be a reference to an array which contains the lines for the body of the message. Each line should be terminated with \&\f(CW\*(C`\en\*(C'\fR (\s-1LF\s0). If Body is given then \f(CW\*(C`Mail::Internet\*(C'\fR will not attempt to read the body from \f(CW\*(C`ARG\*(C'\fR (even if it is specified). .RE .RS 4 .Sp The Mail::Header options \f(CW\*(C`Modify\*(C'\fR, \f(CW\*(C`MailFrom\*(C'\fR and \f(CW\*(C`FoldLength\*(C'\fR may also be given. .RE .SH "METHODS" .IX Header "METHODS" .IP "body ( [ \s-1BODY\s0 ] )" 4 .IX Item "body ( [ 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. .Sp If \fI\s-1BODY\s0\fR 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. .IP "print_header ( [ \s-1FILEHANDLE\s0 ] )" 4 .IX Item "print_header ( [ FILEHANDLE ] )" .PD 0 .IP "print_body ( [ \s-1FILEHANDLE\s0 ] )" 4 .IX Item "print_body ( [ FILEHANDLE ] )" .IP "print ( [ \s-1FILEHANDLE\s0 ] )" 4 .IX Item "print ( [ FILEHANDLE ] )" .PD Print the header, body or whole message to file descriptor \fI\s-1FILEHANDLE\s0\fR. \&\fI$fd\fR should be a reference to a \s-1GLOB\s0. If \fI\s-1FILEHANDLE\s0\fR is not given the output will be sent to \s-1STDOUT\s0. .Sp .Vb 1 \& $mail->print( \e*STDOUT ); # Print message to STDOUT .Ve .IP "as_string ()" 4 .IX Item "as_string ()" Returns the message as a single string. .IP "as_mbox_string ( [ \s-1ALREADY_ESCAPED\s0 ] )" 4 .IX Item "as_mbox_string ( [ ALREADY_ESCAPED ] )" Returns the message as a string in mbox format. \f(CW\*(C`ALREADY_ESCAPED\*(C'\fR, if given and true, indicates that \->escape_from has already been called on this object. .IP "head ()" 4 .IX Item "head ()" Returns the \f(CW\*(C`Mail::Header\*(C'\fR object which holds the headers for the current message .SH "UTILITY METHODS" .IX Header "UTILITY METHODS" The following methods are more a utility type than a manipulation type of method. .IP "remove_sig ( [ \s-1NLINES\s0 ] )" 4 .IX Item "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 \f(CW'\-\- '\fR within the last \f(CW\*(C`NLINES\*(C'\fR of the message. If found then that line and all lines after it will be removed. If \&\f(CW\*(C`NLINES\*(C'\fR is not given a default value of 10 will be used. This would be of most use in auto-reply scripts. .IP "tidy_body ()" 4 .IX Item "tidy_body ()" Removes all leading and trailing lines from the body that only contain white spaces. .IP "reply ()" 4 .IX Item "reply ()" 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. .IP "add_signature ( [ \s-1FILE\s0 ] )" 4 .IX Item "add_signature ( [ FILE ] )" Append a signature to the message. \f(CW\*(C`FILE\*(C'\fR is a file which contains the signature, if not given then the file \*(L"$ENV{\s-1HOME\s0}/.signature\*(R" will be checked for. .IP "send ( [ type [ args.. ]] )" 4 .IX Item "send ( [ type [ args.. ]] )" Send a Mail::Internet message using Mail::Mailer. Type and args are passed on to \f(CW\*(C`Mail::Mailer\*(C'\fR .IP "smtpsend ( [ \s-1OPTIONS\s0 ] )" 4 .IX Item "smtpsend ( [ OPTIONS ] )" Send a Mail::Internet message via \s-1SMTP\s0, requires Net::SMTP .Sp 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. .Sp Options are passed as key-value pairs. Current options are .RS 4 .IP "Host" 4 .IX Item "Host" Name of the \s-1SMTP\s0 server to connect to, or a Net::SMTP object to use .Sp If \f(CW\*(C`Host\*(C'\fR is not given then the \s-1SMTP\s0 host is found by attempting connections first to hosts specified in \f(CW$ENV{SMTPHOSTS}\fR, a colon separated list, then \f(CW\*(C`mailhost\*(C'\fR and \f(CW\*(C`localhost\*(C'\fR. .IP "MailFrom" 4 .IX Item "MailFrom" The e\-mail address which is used as sender. By default, the \fImailaddress()\fR method provides the address of the sender. .IP "To" 4 .IX Item "To" .PD 0 .IP "Cc" 4 .IX Item "Cc" .IP "Bcc" 4 .IX Item "Bcc" .PD Send the email to the given addresses, each can be either a string or a reference to a list of email addresses. If none of \f(CW\*(C`To\*(C'\fR, or \f(CW\*(C`Bcc\*(C'\fR are given then the addresses are extracted from the message being sent. .IP "Hello" 4 .IX Item "Hello" Send a \s-1HELO\s0 (or \s-1EHLO\s0) command to the server with the given name. .IP "Port" 4 .IX Item "Port" Port number to connect to on remote host .IP "Debug" 4 .IX Item "Debug" Debug value to pass to Net::SMPT, see .RE .RS 4 .RE .IP "nntppost ( [ \s-1OPTIONS\s0 ] )" 4 .IX Item "nntppost ( [ OPTIONS ] )" Post an article via \s-1NNTP\s0, requires Net::NNTP. .Sp Options are passed as key-value pairs. Current options are .RS 4 .IP "Host" 4 .IX Item "Host" Name of \s-1NNTP\s0 server to connect to, or a Net::NNTP object to use. .IP "Port" 4 .IX Item "Port" Port number to connect to on remote host .IP "Debug" 4 .IX Item "Debug" Debug value to pass to Net::NNTP, see .RE .RS 4 .RE .IP "escape_from ()" 4 .IX Item "escape_from ()" It can cause problems with some applications if a message contains a line starting with \f(CW`From '\fR, in particular when attempting to split a folder. This method inserts a leading \f(CW\*(C``\*(C'\fR'> on anyline that matches the regular expression \f(CW\*(C`/^\*(C'\fR*From/> .IP "unescape_from ()" 4 .IX Item "unescape_from ()" This method will remove the escaping added by escape_from .SH "SEE ALSO" .IX Header "SEE ALSO" Mail::Header Mail::Address .SH "AUTHOR" .IX Header "AUTHOR" Graham Barr. Maintained by Mark Overmeer .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2002\-2003 Mark Overmeer, 1995\-2001 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.