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: Ralf Hildebrandt <Ralf.Hildebrandt_at_nospam>
Date: Mon Oct 18 2010 - 12:43:34 GMT
To: postfix-users@postfix.org

* Patric Falinder <patric.falinder@omg.nu>:
> Hi,
>
> I'm not really sure if this has to do with Postifx so just tell me if
> I'm wrong.
>
> Is it possible to resend emails that are in a Maildir already?

Yes.

#!/bin/sh

#
# verschickt die gesamte Mail eines Benutzers an $1
#
USAGE="usage: $0 user@domain"

if test $# != 1
then
        echo $USAGE
        exit 1
fi

if ! grep @ <<STOP > /dev/null
$1
STOP
then
        echo $USAGE
        echo No @ in Mail-address
        exit 1
fi

if ! test -d new -a -d cur -a tmp
then
        echo You are not in Maildir
        echo there is no new cur tmp
        exit 1
fi

find cur new tmp -type f | xargs --replace /usr/local/scripts/send_mail $1 {}

---- /usr/local/scripts/send_mail ---- #!/bin/sh /usr/local/sbin/mini_sendmail -syour.mail.host -p25 -fnobody@charite.de $1 < $2 && rm -f $2 -- Ralf Hildebrandt Geschäftsbereich IT | Abteilung Netzwerk Charité - Universitätsmedizin Berlin Campus Benjamin Franklin Hindenburgdamm 30 | D-12203 Berlin Tel. +49 30 450 570 155 | Fax: +49 30 450 570 962 ralf.hildebrandt_at_charite.de | http://www.charite.de