procmail
[Top] [All Lists]

Re: New and need help

1999-02-27 01:04:03
"Gray" <4gray(_at_)inreach(_dot_)com> writes:
This is a multi-part message in MIME format.

Ick.  Can you turn off the sending of HTML in email messages when you're
sending to mailing lists, or at least to the procmail mailing list?


New to this and trying to set up a autoresponder through procmail.
For some reason it is not working for me, below is the code in my
.procmailrc file could some one take a look and see if there is a
problem?


# Set Autorespond variables
:0 ic
* ^TOsales(_at_)programmingjunkies(_dot_)com
*!^FROM_DAEMON
*!^X-Loop: sales(_at_)programmingjunkies(_dot_)com
|(formail -r -A "Precedence: junk"\
-I"From: Auto-Reply <sales(_at_)programmingjunkies(_dot_)com>"\
-I"Subject: Sales Recieved E-Mail"\
-A "X-Loop: sales(_at_)programmingjunkies(_dot_)com";\
cat $FILEDIR/sales.txt)|$SENDMAIL -t

If you looked in the logfile (you _do_ set LOGFILE to something userful
at the top of your .procmailrc, don't you?) you would find an error
from formail giving the proper formail usage.  Why?  When procmail reads
an action, it strips out the backslash-newline pairs, so that the above
action becomes:

(formail -r -A "Precedence: junk"-I"From: Auto-Reply 
<sales(_at_)programmingjunkies(_dot_)com>"-I"Subject: Sales Recieved E-Mail"-A 
"X-Loop: sales(_at_)programmingjunkies(_dot_)com";cat 
$FILEDIR/sales.txt)|$SENDMAIL -t

So, formail is being called with the arguments
        -r
        -A
        Precedence: junk-IFrom: Auto-Reply <sales...>-ISubject: Sales...-A
        X-Loop: sales(_at_)programmingjunkies(_dot_)com

The solution is to always, always, _always_ put a space before a line
continuation backslash.

Other things you might want to correct/change:
        I would suggest being consistent about whether you put a space
                between formail flags and their arguments.  It makes it
                easier to read.
        I would also suggest indenting the second and following lines of
                an action, also to improve readability.
        Use formail -rt instead of just formail -r.  The -t selects a
                more correct reply address
        The procmailex(5) manpage is wrong: use the -I flag with the
                Precedence: header and not the -A flag (sendmail only
                pays attention to one Precedence: header)
        If you have at least procmail version 3.11pre4, use ^TO_ instead
                of ^TO (^TO_ is more accurate for your purposes)
        Instead of using the 'i' flag on the recipe, use the 'h' flag
                to feed just the headering into the action.  You may
                also want to use the 'w' flag to catch errors (say, if
                sendmail dies or refuses to accept the message).

In total, I would write the recipe as:

        :0 whc
        *   ^TO_sales(_at_)programmingjunkies(_dot_)com
        * ! ^FROM_DAEMON
        * ! ^X-Loop: sales(_at_)programmingjunkies(_dot_)com
        |( formail -rt \
                -A "X-Loop: sales(_at_)programmingjunkies(_dot_)com" \
                -I "Precedence: junk" \
                -I "From: Auto-Reply <sales(_at_)programmingjunkies(_dot_)com>" 
\
                -I "Subject: Sales Recieved E-Mail" \
           cat $FILEDIR/sales.txt \
         ) | $SENDMAIL $SENDMAILFLAGS -t

But that's because I'm a fanatic about lining things up.

Philip Guenther

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