procmail
[Top] [All Lists]

Re: ForwardPath function in procmail?

1997-05-30 14:07:00
maustin(_at_)micro(_dot_)ti(_dot_)com (Michael E Austin) writes:
Is there a corresponding function/variable/trick that will make
procmail do the same thing?

I have my system setup like you describe
(/var/mail/<user>/{forward,mailbox,procmailrc) and have used two different
tricks to get procmail to do what I want:

1 - I have used a normal procmail and based on Philip's description of what
    procmail does after .procmailrc processing, I have hacked /etc/procmailrc
    to do the job:

        % cat /etc/procmailrc 
        DROPPRIVS=yes
        ORGMDIR=/var/mail/$LOGNAME
        ORGMAIL=$ORGMDIR/mailbox
        DEFAULT=$ORGMAIL
        
        # try to execute the user's filter
        INCLUDERC=$ORGMDIR/procmailrc
        
        # save in the user's mailbox
        :0:
        * DEFAULT ?? .
        $DEFAULT
        
        # try the ORGMAIL mailbox
        :0:
        * ORGMAIL ?? .
        * ! ORGMAIL ?? ^^$\DEFAULT^^
        $ORGMAIL
        
        # Return failure
        :0
        {
                EXITCODE = 73         # 73 = EX_CANTCREAT
                HOST                  # give up.
        }
        % 

    It worked well (actually the procmailrc is more involved than that since I
    remove duplicates, deliver to backup-mailboxes, setup the PATH and logging
    defaults, ...).

2 - then I upgraded procmail and took advantage of it to compile those
    changes in the executable itself. For procmailrc, you can just put in
    config.h the line

        #define PROCMAILRC      "/var/mail/$LOGNAME/procmailrc"

    in order to move the mailbox to /var/mail/$LOGNAME/mailbox, I've had to do
    a little bit more hacking. I've already sent the patch to the list, so if
    you want it, I'll send it by mail.


-- Stefan

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