1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
|
=head1 NAME
Mail::Message::Construct::Reply - reply to a Mail::Message
=head1 SYNOPSIS
my Mail::Message $reply = $message->reply;
my $quoted = $message->replyPrelude($head->get('From'));
=head1 DESCRIPTION
Complex functionality on L<Mail::Message|Mail::Message> objects is implemented in
different files which are autoloaded. This file implements the
functionality related to creating message replies.
=head1 METHODS
=head2 Constructing a message
$obj-E<gt>B<reply>(OPTIONS)
=over 4
Start a reply to this message. Some of the header-lines of the original
message will be taken. A message-id will be assigned. Some header lines
will be updated to facilitate message-thread detection
(see L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager>).
You may reply to a whole message or a message part.
You may wish to overrule some of the default header settings for the
reply immediately, or you may do that later with C<set> on the header.
ADDRESSES may be specified as string, or
a Mail::Address object, or as array of Mail::Address objects.
Option --Defined in --Default
Bcc undef
Cc <'cc' in current>
From <'to' in current>
Message-ID <uniquely generated>
Subject replySubject()
To <sender in current>
body undef
group_reply <true>
include 'INLINE'
max_signature 10
message_type Mail::Message
postlude undef
prelude undef
quote '> '
signature undef
strip_signature qr/^--\s/
. Bcc ADDRESSES
=over 4
Receivers of blind carbon copies: their names will not be published to
other message receivers.
=back
. Cc ADDRESSES
=over 4
The carbon-copy receivers, by default a copy of the C<Cc> field of
the source message.
=back
. From ADDRESSES
=over 4
Your identification, by default taken from the C<To> field of the
source message.
=back
. Message-ID STRING
=over 4
Supply a STRING as specific message-id for the reply. By default, one is
generated for you. If there are no angles around your id, they will be
added.
=back
. Subject STRING|CODE
=over 4
Force the subject line to the specific STRING, or the result of the
subroutine specified by CODE. The subroutine will be called passing
the subject of the original message as only argument. By default,
L<Mail::Message::replySubject()|Mail::Message::Construct::Reply/"Constructing a message"> is used.
=back
. To ADDRESSES
=over 4
The destination of your message. By default taken from the C<Reply-To>
field in the source message. If that field is not present as well, the
C<From> line is scanned. If they all fail, C<undef> is returned by this
method: no reply message produced.
=back
. body BODY
=over 4
Usually, the reply method can create a nice, sufficient message from the
source message's body. In case you like more complicated reformatting,
you may also create a body yourself first, and pass this on to this
C<reply> method. Some of the other options to this method will be ingored
in this case.
=back
. group_reply BOOLEAN
=over 4
Will the people listed in the C<Cc> headers (those who received the
message where you reply to now) also receive this message as carbon
copy?
=back
. include 'NO'|'INLINE'|'ATTACH'
=over 4
Must the message where this is a reply to be included in the message?
If C<NO> then not. With C<INLINE> a reply body is composed. C<ATTACH>
will create a multi-part body, where the original message is added
after the specified body. It is only possible to inline textual
messages, therefore binary or multipart messages will always be
enclosed as attachment.
=back
. max_signature INTEGER
=over 4
Passed to C<stripSignature> on the body as parameter C<max_lines>. Only
effective for single-part messages.
=back
. message_type CLASS
=over 4
Create a message with the requested type. By default, it will be a
Mail::Message. This is correct, because it will be coerced into
the correct folder message type when it is added to that folder.
=back
. postlude BODY|LINES
=over 4
The line(s) which to be added after the quoted reply lines. Create a
body for it first. This should not include the signature, which has its
own option. The signature will be added after the postlude when the
reply is INLINEd.
=back
. prelude BODY|LINES
=over 4
The line(s) which will be added before the quoted reply lines. If nothing
is specified, the result of the L<replyPrelude()|Mail::Message::Construct::Reply/"Constructing a message"> method
is taken. When C<undef> is specified, no prelude will be added.
=back
. quote CODE|STRING
=over 4
Mangle the lines of an C<INLINE>d reply with CODE, or by prepending a
STRING to each line. The routine specified by CODE is called when the
line is in C<$_>.
By default, C<'E<gt> '> is added before each line. Specify C<undef> to
disable quoting. This option is processed after the body has been decoded.
=back
. signature BODY|MESSAGE
=over 4
The signature to be added in case of a multi-part reply. The mime-type
of the signature body should indicate this is a used as such. However,
in INLINE mode, the body will be taken, a line containing C<'-- '> added
before it, and added behind the epilogue.
=back
. strip_signature REGEXP|STRING|CODE
=over 4
Remove the signature of the sender. The value of this parameter is
passed to L<Mail::Message::Body::stripSignature(pattern)|Mail::Message::Body::Construct/"Constructing a body"> unless the
source text is not included. The signature is stripped from the message
before quoting.
When a multipart body is encountered, and the message is included to
ATTACH, the parts which look like signatures will be removed. If only
one message remains, it will be the added as single attachment, otherwise
a nested multipart will be the result. The value of this option does not
matter, as long as it is present. See L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>.
=back
I<Example:>
my $reply = $msg->reply
( prelude => "No spam, please!\n\n"
, postlude => "\nGreetings\n"
, strip_signature => 1
, signature => $my_pgp_key
, group_reply => 1
);
=back
$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
=over 4
Produces a list of lines (usually only one), which will preceded the
quoted body of the message. STRING must comply to the RFC822 email
address specification, and is usually the content of a C<To> or C<From>
header line. If a FIELD is specified, the field's body must be
compliant. Without argument -or when the argument is C<undef>- a
slightly different line is produced.
An characteristic example of the output is
On Thu Oct 13 04:54:34 1995, him@example.com wrote:
=back
$obj-E<gt>B<replySubject>(STRING)
Mail::Message-E<gt>B<replySubject>(STRING)
=over 4
Create a subject for a message which is a reply for this one. This routine
tries to count the level of reply in subject field, and transform it into
a standard form. Please contribute improvements.
I<Example:>
subject --> Re: subject
Re: subject --> Re[2]: subject
Re[X]: subject --> Re[X+1]: subject
subject (Re) --> Re[2]: subject
subject (Forw) --> Re[2]: subject
<blank> --> Re: your mail
=back
=head1 DIAGNOSTICS
I<Error:> Cannot include reply source as $include.
Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">. Valid
choices are C<NO>, C<INLINE>, and C<ATTACH>.
=head1 REFERENCES
See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
=head1 COPYRIGHTS
Distribution version 2.068.
Written by Mark Overmeer (mark@overmeer.net). See the ChangeLog for
other contributors.
Copyright (c) 2001-2006 by the author(s). All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
|