my $message = Email::Simple->new(join '', <>);
my $from = (Email::Address->parse($message->header('From'));
my $reply = reply to => $message,
from => '"Casey West" <[email protected]>',
all => 1,
body => <<__RESPONSE__;
Thanks for the message, I'll be glad to explain...
DESCRIPTIONThis software takes the hard out of generating replies to email messages.
my $reply = reply to => $message, from => '"Casey West" <[email protected]>', all => 1; self => 0, attach => 1, quote => 1, top_post => 0, keep_sig => 1, prefix => ': ', attrib => sprintf("From %s, typer of many words:", $from->name), body => <<__RESPONSE__; Thanks for the message, I'll be glad to explain the picture... __RESPONSE__
This function accepts a number of named parameters and returns an email message object of type "Email::MIME" or "Email::Simple", depending on the parameters passed. Lets review those parameters now.
- This required parameter is the email message you're replying to. It can represent a number of object types, or a string containing the message. This value is passed directly to "Email::Abstract" without passing go or collecting $200 so please, read up on its available plugins for what is allowed here.
- This optional parameter specifies an email address to use indicating the sender of the reply message. It can be a string or an "Email::Address" object. In the absence of this parameter, the first address found in the original message's "To" header is used. This may not always be what you want, so this parameter comes highly recommended.
- This optional parameter indicates weather or not you'd like to ``Reply to All.'' If true, the reply's "Cc" header will be populated with all the addresses in the original's "To" and "Cc" headers. By default, the parameter is false, indicating ``Reply to Sender.''
- This optional parameter decides weather or not an address matching the "from" address will be included in the list of "all" addresses. If true, your address will be preserved in that list if it is found. If false, as it is by default, your address will be removed from the list. As you might expect, this parameter is only useful if "all" is true.
- This optional parameter allows for the original message, in its entirety, to be encapsulated in a MIME part of type "message/rfc822". If true, the returned object from "reply" will be a "Email::MIME" object whose second part is the encapsulated message. If false, none of this happens. By default, none of this happens.
- This optional parameter, which is true by default, will quote the original message for your reply. If the original message is a MIME message, the first "text/plain" type part will be quoted. If it's a Simple message, the body will be quoted. Well, that's only if you keep the parameter true. If you don't, none of this occurs.
- This optional parameter, whose use is generally discouraged, will allow top posting when true. It will implicitly set "quote" to true, and put your "body" before the quoted text. It is false by default, and you should do your best to keep it that way.
- This optional parameter toggles the signature stripping mechanism. True by default, the original quoted body will have its signature removed. When false, the signature is left in-tact and will be quoted accordingly. This is only useful when "quote" is true.
- This optional parameter specifies the quoting prefix. By default, it's ">", but you can change it by setting this parameter. Again, only useful when "quote" is true.
- This optional parameter specifies the attribution line to add to the beginning of quoted text. By default, the name or email address of the original sender is used to replace %s in the string, "%s wrote:". You may change that with this parameter. No special formats, "sprintf()" or otherwise, are provided for your convenience. Sorry, you'll have to make due. Like "prefix" and "keep_sig", this is only good when "quote" is true.
- This required parameter contains your prose, your manifesto, your reply. Remember to spell check!
AUTHORCasey West <[email protected]>
COPYRIGHT AND LICENSEThis software is copyright (c) 2004 by Casey West.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.