procmail
[Top] [All Lists]

Re: Problem with autoresponse

1999-04-23 22:32:18
"James Kelty" <jkelty(_at_)digital-impact(_dot_)com> writes:
When I run this recipie.....
...
:0ch
* ^To*
*!^FROM_DAEMON
*!^X-Loop: james1(_at_)testmail\(_dot_)m0\(_dot_)net
| (formail -r -A "Precedence: junk" \
 -I"From: james1(_at_)testmail\(_dot_)m0\(_dot_)net"\
 -I"Subject: Not home, sorry"\
 -A"X-Loop: james1(_at_)testmail\(_dot_)m0\(_dot_)net"\
echo "";\
cat $FILEDIR/auto.txt) | $SENDMAIL -t

I get this error in my log file.....

...
procmail: Executing " (formail -r -A "Precedence: junk" \
 -I"From: james1(_at_)testmail\(_dot_)m0\(_dot_)net"\
 -I"Subject: Not home, sorry"\
 -A"X-Loop: james1(_at_)testmail\(_dot_)m0\(_dot_)net"\
echo "";\
cat $FILEDIR/auto.txt) | $SENDMAIL -t"
...
Usage: formail [-bczfrktqY] [-D nnn idcache] [-p prefix] [-l folder]
       [-xXaAiIuU field] [-R ofield nfield]
  Or: formail [+nnn] [-nnn] [-bczfrktnedqBY] [-D nnn idcache] [-p prefix]
       [-m nnn] [-l folder] [-xXaAiIuU field] [-R ofield nfield]
       -s [prg [arg ...]]

Okay, let's look closely at the arguments to formail.  After performing
word splitting and quoting like the shell does and placing one argument
per line we get:

0       formail
1       -r
2       -A
3       Precedence: junk
4       -IFrom: james1(_at_)testmail\(_dot_)m0\(_dot_)net
5       -ISubject Not home, sorry
6       -AX-Loop: james1(_at_)testmail\(_dot_)m0\(_dot_)netecho
7                                               <--- an empty argument

So, formail is complaing because the last argument isn't a known flag.

There are really two errors, compounded by an item of inadvisable
style.  The errors are that you left out the semicolon before the
'echo' command and that you put backslashes before the periods (periods
are not special inside of double quotes).  The style problem is that
you didn't always put a space before the backslash that continues a
line.  It's also *almost always* better to use formail -r with the -t
flag.  Formail -r without -t is more likely to reply to the wrong
address.  Fixing those gives you the working version:

        | (formail -rt -A "Precedence: junk" \
          -I"From: james1(_at_)testmail(_dot_)m0(_dot_)net" \
          -I"Subject: Not home, sorry" \
          -A"X-Loop: james1(_at_)testmail(_dot_)m0(_dot_)net"; \
        echo ""; \
        cat $FILEDIR/auto.txt) | $SENDMAIL -t

I also suggest that you be consistent in any given recipe as to whether
the -A/-I flags are attached to their arguments.  My personal style
also calls for more indentation, as I think it makes action easier on
the eye.

        | (formail -rt \
                -A "Precedence: junk" \
                -I "From: james1(_at_)testmail(_dot_)m0(_dot_)net" \
                -I "Subject: Not home, sorry" \
                -A "X-Loop: james1(_at_)testmail(_dot_)m0(_dot_)net"; \
           echo ""; \
           cat $FILEDIR/auto.txt \
          ) | $SENDMAIL -t

...but that's a personal choice.


Philip Guenther

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