procmail
[Top] [All Lists]

Re: Using procmail to requeue incoming email?

1999-03-03 22:18:19
cueman(_at_)cuenet(_dot_)com writes:
I need to take email addressed to an account, test(_at_)cuenet(_dot_)com,
and queue it in it's own queue. I am running Sendmail. So
in my aliases file I:

test: user

Then in user's account I tried to setup a .procmailrc like:

PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:.
MAILDIR=$HOME/                 # You'd better make sure it exists
DEFAULT=/var/spool/mail/user
LOGFILE=$HOME/Mail/from
LOCKFILE=$HOME/.lockmail
ARCDATE=`/bin/date +%y-%m`
SENDMAILFLAGS= "-oem -odq -oi  -oC/etc/sendmail.cf2 -oQ/home/lists/mqueue"

               :0
               * !^Subject:.*retrieve
               !


The condition is just there to satisfy the recipe's need for a
condition, 'retrieve' will never occur there or will be replaced later.
...
But the email 'testing' never gets requeued in /home/user/mqueue.

The main problem is that you never tell sendmail who to send the
message to.  You need to pass sendmail the recipient address on the
action line.  (Don't use the -t flag, as that'll break things if this
address is ever, say, subscribed to a mailing list.  This would be
another case of header/envelope confusion.)

The next problem is that SENDMAILFLAGS cannot contain more than one
argument for sendmail.  This is a known bug which I hope to fix soon.

BTW: To quote the procmailrc(5) manpage:

          :0 [flags] [ : [locallockfile] ]
          <zero or more conditions (one per line)>
          <exactly one action line>

Note that there can be zero conditions, so the following would work:

        :0
        |$SENDMAIL -C/etc/sendmail.cf2 -oQ/home/lists/mqueue \
                -oem -odq -oi test

I assume that the /etc/sendmail.cf2 doesn't have the 'test' alias in
it.

(Actually, the Right Way to do this is to have a "requeue" mailer in
the sendmail.cf that invokes sendmail directly instead of going through
procmail.  I tried that once for my own purposes but couldn't get it
work though I can't remember why.)


Philip Guenther

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