Postfix::ContentFilter - a perl content_filter for postfix
Version 1.11
use Postfix::ContentFilter; $exitcode = Postfix::ContentFilter->process(sub{ $entity = shift; # isa MIME::Entity # do something with $entity return $entity; }); # Or specifying the parser my $cf = Postfix::ContentFilter->new({ parser => 'Mail::Message' }); $exitcode = $cf->process(sub{ $entity = shift; # isa Mail::Message # do something with $entity return $entity; }); exit $exitcode;
Postfix::ContentFilter can be used for content_filter scripts, as described here: http://www.postfix.org/FILTER_README.html.
content_filter
new
footer
MIME::Entity
Mail::Message
Alternatively process can be called directly.
process
parser() specifies the parser to use, which can be either MIME::Parser or Mail::Message. It defaults to MIME::Parser, if available, or Mail::Message whichever could be found first. When called without any arguments, it returns the current parser.
parser()
MIME::Parser
process() reads the mail from STDIN (or $inputhandle, if given), parses it, calls the coderef and finally runs sendmail with our own command-line arguments (@ARGV).
process()
STDIN
$inputhandle
sendmail
@ARGV
This function returns the exitcode of sendmail.
$sendmail
$sendmail defaults to /usr/sbin/sendmail.
/usr/sbin/sendmail
$Postfix::ContentFilter::sendmail = [ '/usr/local/sbin/sendmail', '-G', '-i' ];
Please note $sendmail must be an arrayref. Don't forget to use the proper arguments for sendmail, or just replace the first element in array.
Additional arguments can be added with:
push @$Postfix::ContentFilter::sendmail => '-t';
$output
Any output from sendmail command is populated in $output.
$parser
The MIME::Parser object is available via $parser. To tell where to put the things, use:
$Postfix::ContentFilter::parser->output_under('/tmp');
If taint mode is on, %ENV will be stripped:
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV', 'PATH'}
So set $Postfix::ContentFilter::sendmail to an absolute path, if you are using taint mode. See perlsec(1) for more details about unsafe variables and tainted input.
$Postfix::ContentFilter::sendmail
postconf(5)
postfix(1)
David Zurborg, <zurborg at cpan.org>
<zurborg at cpan.org>
Please report any bugs or feature requests trough my project management tool. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Postfix::ContentFilter
You can also look for information at:
Redmine: Homepage of this module
http://development.david-zurb.org/projects/libpostfix-contentfilter-perl
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Postfix-ContentFilter
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Postfix-ContentFilter
CPAN Ratings
http://cpanratings.perl.org/d/Postfix-ContentFilter
Search CPAN
http://search.cpan.org/dist/Postfix-ContentFilter/
Copyright 2014 David Zurborg, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the ISC license.
To install Postfix::ContentFilter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Postfix::ContentFilter
CPAN shell
perl -MCPAN -e shell install Postfix::ContentFilter
For more information on module installation, please visit the detailed CPAN module installation guide.