1Mail::Message::ConstrucUts:e:rReCaodn(t3r)ibuted Perl DoMcauimle:n:tMaetsisoange::Construct::Read(3)
2
3
4

NAME

6       Mail::Message::Construct::Read - read a Mail::Message from a file
7       handle
8

SYNOPSIS

10        my $msg1 = Mail::Message->read(\*STDIN);
11        my $msg2 = Mail::Message->read(\@lines);
12

DESCRIPTION

14       When complex methods are called on a "Mail::Message" object, this
15       package is autoloaded to support the reading of messages directly from
16       any file handle.
17

METHODS

19   Constructing a message
20       Mail::Message->read(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES,
21       OPTIONS)
22           Read a message from a FILEHANDLE, SCALAR, a reference to a SCALAR,
23           or a reference to an array of LINES.  Most OPTIONS are passed to
24           the new() of the message which is created, but a few extra are
25           defined.
26
27           Please have a look at build() and buildFromBody() before thinking
28           about this "read" method.  Use this "read" only when you have a
29           file-handle like STDIN to parse from, or some external source of
30           message lines.  When you already have a separate set of head and
31           body lines, then "read" is certainly not your best choice.
32
33           Some people use this method in a procmail script: the message
34           arrives at stdin, so we only have a filehandle.  In this case, you
35           are stuck with this method.  The message is preceded by a line
36           which can be used as message separator in mbox folders.  See the
37           example how to handle that one.
38
39           This method will remove "Status" and "X-Status" fields when they
40           appear in the source, to avoid the risk that these fields
41           accidentally interfere with your internal administration, which may
42           have security implications.
43
44            -Option             --Default
45             body_type            undef
46             strip_status_fields  <true>
47
48           body_type => CLASS
49             Force a body type (any specific implementation of a
50             Mail::Message::Body) to be used to store the message content.
51             When the body is a multipart or nested, this will be overruled.
52
53           strip_status_fields => BOOLEAN
54             Remove the "Status" and "X-Status" fields from the message after
55             reading, to lower the risk that received messages from external
56             sources interfere with your internal administration.  If you want
57             fields not to be stripped (you would like to disable the
58             stripping) you probably process folders yourself, which is a Bad
59             Thing!
60
61           example:
62
63            my $msg1 = Mail::Message->read(\*STDIN);
64            my $msg2 = Mail::Message->read(\@lines, log => 'PROGRESS');
65            $folder->addMessages($msg1, $msg2);
66
67            my $msg3 = Mail::Message->read(<<MSG);
68            Subject: hello world
69            To: you@example.com
70                                 # warning: empty line required !!!
71            Hi, greetings!
72            MSG
73
74            # promail example
75            my $fromline = <STDIN>;
76            my $msg      = Mail::Message->read(\*STDIN);
77            my $coerced  = $mboxfolder->addMessage($msg);
78            $coerced->fromLine($fromline);
79

SEE ALSO

81       This module is part of Mail-Box distribution version 2.097, built on
82       January 26, 2011. Website: http://perl.overmeer.net/mailbox/
83

LICENSE

85       Copyrights 2001-2011 by Mark Overmeer. For other contributors see
86       ChangeLog.
87
88       This program is free software; you can redistribute it and/or modify it
89       under the same terms as Perl itself.  See
90       http://www.perl.com/perl/misc/Artistic.html
91
92
93
94perl v5.12.3                      2011-01-26 Mail::Message::Construct::Read(3)
Impressum