NAME
Postfix::ContentFilter - a perl content_filter for postfix
VERSION
Version 1.10
SYNOPSIS
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;
DESCRIPTION
Postfix::ContentFilter can be used for content_filter
scripts, as described here: http://www.postfix.org/FILTER_README.html.
FUNCTIONS
new($args) new
creates a new Postfix::Contentfilter. It takes an optional argument of a hash with the key 'parser', which specifies the parser to use as per footer
. This can be either MIME::Entity
or Mail::Message
.
Alternatively process
can be called directly.
parser($string)
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.
process($coderef [, $inputhandle])
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
).
This function returns the exitcode of sendmail
.
VARIABLES
$sendmail
$sendmail
defaults to/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 forsendmail
, 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');
CAVEATS
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.
SEE ALSO
AUTHOR
David Zurborg, <zurborg at cpan.org>
BUGS
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.
SUPPORT
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
CPAN Ratings
Search CPAN
COPYRIGHT & LICENSE
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.