Mail::Qmail::Queue::Receive::Body - Receive message body when emulating qmail-queue
use Mail::Qmail::Queue::Receive::Body; my $qq_body = Mail::Qmail::Queue::Receive::Body->new or die "Couldn't get qmail-queue body\n" print "Message body: ",$qq_body->body,"\n"; my $fh = $qq_body->body_fh or die "Error getting body handle: $!\n"; while (<$fh>) { s/perl/Pathologically Eclectic Rubbish Lister/gi; print; } $fh->close or die "Error closing message: $!\n";
Mail::Qmail::Queue::Receive::Body is designed for use in qmail-queue emulation. This is a way of modifying the behavior of qmail by replacing its queueing mechanism with your own program, which may modify or reject the message, then call the real qmail-queue program to queue the message. This is commonly done with Bruce Guenter's QMAILQUEUE patch (http://www.qmail.org/top.html#qmailqueue), also included in netqmail (http://www.qmail.org/netqmail/). This patch lets you override the standard qmail-queue program by setting the environment variable QMAILQUEUE. It can also be done by renaming the original qmail-queue, installing your script in its place, and having your script call the renamed qmail-queue to inject the message.
Mail::Qmail::Queue::Receive::Body
qmail-queue
QMAILQUEUE
For a simplified interface, see Mail::Qmail::Queue::Message. To read the message envelope, see Mail::Qmail::Queue::Receive::Envelope. To re-inject the message, see Mail::Qmail::Queue::Send.
Note that the specifications for qmail-queue's interface require that the message be read before the envelope.
The constructor and methods of this class will die if they encounter a serious error. If you would prefer different behavior, use eval to catch these and handle them as exceptions.
die
eval
Creates a new qmail-queue message body reader, but does not start reading it.
Available options are:
Read the body from the specified file handle, instead of the default of file desriptor 0.
Returns a filehandle from which the body can be read.
Closes the filehandle with the message body, and returns the result of the close.
close
Returns the entire body as a string, then closes the filehandle. Note that this can consume a lot of memory for a very large message; reading it from the handle returned by the body_fh method will be more efficient.
body_fh
qmail-queue(8), Mail::Qmail::Queue::Message, Mail::Qmail::Queue::Receive::Envelope, Mail::Qmail::Queue::Send.
Copyright 2006 Scott Gifford.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mail::Qmail::Queue::Send, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::Qmail::Queue::Send
CPAN shell
perl -MCPAN -e shell install Mail::Qmail::Queue::Send
For more information on module installation, please visit the detailed CPAN module installation guide.