procmail
[Top] [All Lists]

Re: Procmail configuration question

2002-08-05 10:57:49
Matthias Wulkow <trespassa(_at_)gmx(_dot_)de> writes:
little question, I have this procmailrc, it's working, but not 100% as
I want.  The mail is being replied, but it doesn't reach its destination,
alias of ftp-admin.  Ftp-admin doesn't get the mail, why? What should
I add?
...
[root(_at_)Server /root]# cat /etc/procmailrc
VERBOSE=yes
LOGFILE=/var/log/procmail/procmail.log

:0
* ^TOftp-admin
* ^Subject:.*ftp-liste
* ! ^X-Loop: ftp-admin(_at_)mydomain\(_dot_)net
{

:0 c :
| sudo /usr/sbin/ftp-mail-text.cfg > /etc/ftp-mail-text.txt

:0
| ( formail -r -A "X-Loop: ftp-admin(_at_)mydomain(_dot_)net" -I "From: 
ftp-admin(_at_)mydomai
n.net" ; cat /etc/ftp-mail-text.txt ) |
$SENDMAIL -oi -t
}


First off, aliases are processed by the MTA, _before_ procmail is ever
invoked.  So the above is not processed as ftp-admin but as the user to
whom ftp-admin is aliased.

Next, it is almost always a mistake to use ^TO in the /etc/procmailrc
file.  A message sent to ftp-admin and another user will trigger the
condition for _both_ the recipients, not just ftp-admin.  Instead,
you should either

a) leave the block in the /etc/procmailrc, but first match the name of
   the user to whom ftp-admin aliased against the LOGNAME variable; or
b) put the entire block in the .procmailrc of the user to whom ftp-admin
   is aliased and continue to use ^TO; or
c) create a real ftp-admin user and put the auto-reply _and_ the
   forwarding in that user's .procmailrc

IMNSHO, the last of these is the best, at it avoids hardcoding the
forwarding address in more than one place and may even let you eliminate
the sudo.


Third: what prevents two messages arriving at approximately the same time
from 'colliding' when the recipes overwrite the /etc/ftp-mail-text.txt
file?  You need to either (a) use a lock file, or (b) use a different
file for each procmail process.  I would also recommend _not_ putting
temporary files like ftp-mail-text.txt in /etc.  You should put that in
ftp-admin's home directory (if you take option (c) above), somewhere in
/var, or in /tmp.  However, you shouldn't put it in /tmp or any other
world-writable directory without taking care to avoid symlink races
(i.e., use mkstemp!)


Okay, now for your question!

The last recipe in the nested block is a deliverying recipe.  Therefore,
when procmail finishes executing it, it stops and doesn't continue on
to perform the implicit delivery to $DEFAULT.  You need to put the 'c'
flag on the recipe.


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>