NAME

Postfix::ContentFilter - a perl content_filter for postfix

VERSION

Version 1.02

SYNOPSIS

    use Postfix::ContentFilter;

    $exitcode = Postfix::ContentFilter->process(sub{
	$entity = shift; # isa MIME::Entity
	
	# 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

process($coderef [, $inputhandle])

process() reads the mail from STDIN (or $inputhandle, if given), parses it with MIME::Parser, call 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 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');

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:

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.