procmail
[Top] [All Lists]

Re: trivial procmail question...

2002-10-23 02:56:13
"Safran von Twesla" <elektrik(_at_)gmx(_dot_)net> writes:
I'm trying to insert a mini-script into a procmail command... it
doesn't seem to work... I get a syntax error... 
...
| if [ -f "/tmp/reply/$KEYWORD2.html" -eq 0 ] then { (formail -r -A "X-Loop: 
info(_at_)domain(_dot_)net" -I "From: info(_at_)domain(_dot_)net" -I 
"MIME-version: 1.0" -I "Content-Type: multipart/mixed; 
boundary=\"htmlfilexyz\"" ; echo "--htmlfilexyz" ; echo "Content-type: 
TEXT/PLAIN; charset=ISO-8859-1" ; cat /etc/ftp-mail-text.txt ; echo "" ; echo 
"--htmlfilexyz" ; echo "Content-Type: TEXT/HTML ; charset=ISO-8859-1; 
name=\"$KEYWORD2.html\"" ; echo "Content-Transfer-Encoding:8bit" ; echo"" ; 
cat /tmp/reply/$KEYWORD2.html ; echo "--htmlfilexyz--")  | $SENDMAIL -oi -t } 
else exit 1 fi

Did you consider just trying to run that command at your shell prompt?
It contains several syntax errors:

1) '[ -f "/tmp/reply/$KEYWORD2.html" -eq 0 ]' is not valid.  Perhaps you
   just meant '[ -f "/tmp/reply/$KEYWORD2.html" ]'
2) 'then', 'fi', and close brace are only special when the shell is
   expecting a command, so you need to put a semi-colon in front of them
   or get rid of them

So, in grand tradition, here's my untested version:

| test -f "/tmp/reply/$KEYWORD2.html" && \
  ( formail -r -A"X-Loop: info(_at_)domain(_dot_)net" \
        -I"From: info(_at_)domain(_dot_)net" \
        -I"MIME-version: 1.0" \
        -I"Content-Type: multipart/mixed; boundary=\"htmlfilexyz\"" ; \
    echo "--htmlfilexyz" ; \
    echo "Content-type: TEXT/PLAIN; charset=ISO-8859-1" ; \
    cat /etc/ftp-mail-text.txt ; \
    echo "" ; \
    echo "--htmlfilexyz" ; \
    echo "Content-Type: TEXT/HTML; charset=ISO-8859-1;" ; \
    echo "     name=\"$KEYWORD2.html\"" ; \
    echo "Content-Transfer-Encoding: 8bit" ; \
    echo "Content-Disposition: attachment; filename=\"$KEYWORD2.html\"" ; \
    echo "" ; \
    cat /tmp/reply/$KEYWORD2.html ; \
    echo "--htmlfilexyz--" )  | $SENDMAIL $SENDMAILFLAGS -t


Philip Guenther

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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