Hi all,
thank you for your replys. I will try to give more details:
The mail for me goes to the default mailbox /var/mail/tanger first. I can not
pipe these mails directly to procmail in my .forward, because sendmail is
configured so, that it gives the error: forward to program is unsafe, or
something like that. Our sysadmin has in principle no problem to allow that,
but has not the time to find out how, and I do not know.
So I have an "at" job, which runs every minute:
------- my cron job (in a file called "mail_daemon") -----
#!/bin/sh
$HOME/bin/process_mail 2>/dev/null
at -s -f $HOME/bin/mail_daemon 'now + 1 min ' 2>/dev/null
------- end of cron job --------
The script process_mail is the one, mentioned in the procmail man-page:
---- the script which checks my mailbox -------
#!/bin/sh
ORGMAIL=/var/mail/$LOGNAME
if cd $HOME &&
test -s $ORGMAIL &&
lockfile -r 0 -l 1024 .newmail.lock 2>/dev/null
then
trap "rm -f .newmail.lock" 1 2 3 13 15
umask 077
lockfile -l 1024 -ml
cat $ORGMAIL >>.newmail &&
cat /dev/null >$ORGMAIL
lockfile -mu
formail -ds procmail <.newmail &&
rm -f .newmail
rm -f .newmail.lock
fi
exit 0
--------- end of script which checks my mailbox ------
I give you now a part of my .procmailrc
----- relevant part of .procmailrc
VERBOSE=on
PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:.
MAILDIR=$HOME/Mail # You'd better make sure it exists
LOGFILE=$MAILDIR/zzz_procmail.log
DEFAULT=$MAILDIR/mbox
# special commands in mail
SHELL=/usr/bin/csh
# and the stuff from person1
:0 c:
* ^From.*person1
* !(^Subject.*Returned)
! person2(_at_)foo2(_dot_)bar
:0 c:
* ^From.*person1
* !(^Subject.*Returned)
! person3(_at_)foo3(_dot_)bar
:0:
* ^From.*person1
zock
----- end of relevant part of .procmailrc -------
What happens is the following: a mail from person1 is forwarded to person2. Due
to problems at the mailsystem of person2, the mail comes back from the
mailsystem of foo2.bar. Attached to that mail is the old mail, I sended to
person2. Procmail then splits up these returned mail in two mails. One from
the mailsystem of foo2.bar which goes in my default mailbox which is defined
somewhere else in the .procmailrc. The other one is the original one. Procmail
detects that it is from person1 and sends it again to person2. A loop is set up.
I hope, now you have all relevant information. Many thanks for your help.
Ralf