postfix-users October 2010 archive
Main Archive Page > Month Archives  > postfix-users archives
postfix-users: Re: Resend emails from a Maildir

Re: Resend emails from a Maildir

From: Victor Duchovni <Victor.Duchovni_at_nospam>
Date: Tue Oct 19 2010 - 19:22:42 GMT
To: postfix-users@postfix.org

On Mon, Oct 18, 2010 at 11:37:18PM +0200, mouss wrote:

> - get the MAIL FROM address from the "Return-Path" header. with this you
> can do: sendmail -f $returnpath yourdestinationemail

Make that:

        sendmail -i -f "$returnpath" -- "$destpath" < msgfile

The returnpath can have all kinds of interesting characters. If using
Perl, it is highly advisable to entirely bypass shell argument parsing:

        $prog = "/usr/sbin/sendmail";
        @rcpts = ( q{joe@example.com} );
        @args = qw(sendmail -i);
        push(@args, "-f", "$envsender");
        push(@args, "--", @rcpts);
        system { $prog } @args;
        if (($code = $?) ne 0) {
            # handle errors
        }

-- Viktor.