procmail
[Top] [All Lists]

Re: Non-standard Unix delivery (using a database instead of password file!)

1998-06-15 04:57:55
Thanks

I eventually worked out the following recipes:

OTO=`/usr/local/bin/formail -xTo: `

:0
*
DELMAILBOX=| /usr/local/etc/procmail_process.pl


# Deliver if local (will always be /var/mail/something)
:0:
* DELMAILBOX ?? ^/var/mail/
$DELMAILBOX


# If we haven't delivered locally, possibly forward the mail to another
server
:0 E
* DELMAILBOX ?? @
|(formail -A "X-ServerInfo: $OTO" ; \
)|$SENDMAIL -oi $DELMAILBOX


# Bounce if non-local
:0 EWi
* ? test $DELMAILBOX = "INVALIDADDRESS"
|(formail -rkI "Subject: Returned Mail: the address $VIPTO is not valid.
Your message is att
ached" ; \
)|$SENDMAIL -oi -t -f postmaster(_at_)vip(_dot_)uk(_dot_)com


.. where procmail_process.pl always returns:

    . nothing if the database is dead, so mail gets re-queued
    . /var/mail/maildrop_file - so mail gets delivered locally
    . an address with an @ in it - so mail is forwarded to its destination
server
    . INVALIDADDRESS - which will hopefully bounce the mail.

What I still can't figure out is the final bit .. how to nicely bounce an
undeliverable mail in the correct fashion. Clearly what I currently
have is no good because the message IS NOT attached!


Cheers

============================================================
John P Connor                     email: John(_dot_)Connor(_at_)icl(_dot_)net

Internet Support Specialist           http://dirk.iclweb.com

ICL Electronic Business
Managed Services
============================================================