.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .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. \*(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- .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" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Mail::Message::Construct::Read 3pm" .TH Mail::Message::Construct::Read 3pm "2016-12-27" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mail::Message::Construct::Read \- read a Mail::Message from a file handle .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& my $msg1 = Mail::Message\->read(\e*STDIN); \& my $msg2 = Mail::Message\->read(\e@lines); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" When complex methods are called on a \f(CW\*(C`Mail::Message\*(C'\fR object, this package is autoloaded to support the reading of messages directly from any file handle. .SH "METHODS" .IX Header "METHODS" .SS "Constructing a message" .IX Subsection "Constructing a message" .ie n .IP "Mail::Message\->\fBread\fR($fh|STRING|SCALAR|ARRAY, %options)" 4 .el .IP "Mail::Message\->\fBread\fR($fh|STRING|SCALAR|ARRAY, \f(CW%options\fR)" 4 .IX Item "Mail::Message->read($fh|STRING|SCALAR|ARRAY, %options)" Read a message from a \f(CW$fh\fR, \s-1STRING, SCALAR,\s0 or a reference to an \&\s-1ARRAY\s0 of lines. Most \f(CW%options\fR are passed to the \fInew()\fR of the message which is created, but a few extra are defined. .Sp Please have a look at \fIbuild()\fR and \fIbuildFromBody()\fR before thinking about this \f(CW\*(C`read\*(C'\fR method. Use this \f(CW\*(C`read\*(C'\fR only when you have a file-handle like \s-1STDIN\s0 to parse from, or some external source of message lines. When you already have a separate set of head and body lines, then \f(CW\*(C`read\*(C'\fR is certainly \fBnot\fR your best choice. .Sp Some people use this method in a procmail script: the message arrives at stdin, so we only have a filehandle. In this case, you are stuck with this method. The message is preceded by a line which can be used as message separator in mbox folders. See the example how to handle that one. .Sp This method will remove \f(CW\*(C`Status\*(C'\fR and \f(CW\*(C`X\-Status\*(C'\fR fields when they appear in the source, to avoid the risk that these fields accidentally interfere with your internal administration, which may have security implications. .Sp .Vb 3 \& \-Option \-\-Default \& body_type undef \& strip_status_fields .Ve .RS 4 .IP "body_type => \s-1CLASS\s0" 2 .IX Item "body_type => CLASS" Force a body type (any specific implementation of a Mail::Message::Body) to be used to store the message content. When the body is a multipart or nested, this will be overruled. .IP "strip_status_fields => \s-1BOOLEAN\s0" 2 .IX Item "strip_status_fields => BOOLEAN" Remove the \f(CW\*(C`Status\*(C'\fR and \f(CW\*(C`X\-Status\*(C'\fR fields from the message after reading, to lower the risk that received messages from external sources interfere with your internal administration. If you want fields not to be stripped (you would like to disable the stripping) you probably process folders yourself, which is a Bad Thing! .RE .RS 4 .Sp example: .Sp .Vb 3 \& my $msg1 = Mail::Message\->read(\e*STDIN); \& my $msg2 = Mail::Message\->read(\e@lines, log => \*(AqPROGRESS\*(Aq); \& $folder\->addMessages($msg1, $msg2); \& \& my $msg3 = Mail::Message\->read(<; \& my $msg = Mail::Message\->read(\e*STDIN); \& my $coerced = $mboxfolder\->addMessage($msg); \& $coerced\->fromLine($fromline); .Ve .RE .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of Mail-Box distribution version 2.120, built on September 21, 2016. Website: \fIhttp://perl.overmeer.net/mailbox/\fR .SH "LICENSE" .IX Header "LICENSE" Copyrights 2001\-2016 by [Mark Overmeer]. For other contributors see ChangeLog. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://www.perl.com/perl/misc/Artistic.html\fR