procmail
[Top] [All Lists]

RE: generating vacation response

2000-04-25 16:57:27
Is there an easier way calling sed without having to do all
that quoting calling sed a second time to make sure sed
(the first) doesn't barf?

First of all, the guy who posted to have the blank line in your
vacation msg was right-on.

Second, let's use my emailed suggestion of using formail -rk,
which you're already calling anyway, to quote back the message.


  :0
  * ^Subject: \/.*
  { }

What's the curly bracket stuff for here?  It confused me
to see { } like that.  Why not just open-brace, and close
when you're done?


  :0 hfw
  | formail -rI"Precedence: junk" \
      -I"Subject: Out of office [$MATCH]" \
      -A"X-Loop: volker out of office"
  :0 bfw
  | ( S="`echo $MATCH | sed -e 's,/,\\/,g' -e 's/&/\\\\&/g' `"; \
    sed -e 's/\$SUBJECT/'"$S"'/g' <$PROCDIR/procmail_vacationmsg; \
    echo ""; \
    awk '{print "> "$0}'; )


Okay, how about:

     :0 hi  # there doesn't HAVE to be a whitespace after : - see RFCs
     * ^Subject:[       ]*\/.*
     { SUBJ = "$MATCH" }

     :0 wih  # not sure if ] or } or ) really are probs - see SHELLMETAS
     * SUBJ ?? ['"`&@!$(/)\[{\]}\\|]
     { S = `echo "$SUBJ" | sed 's,/,\\/,g; s/&/\\\\&/g` }
     # Maybe we could/should use an -f file for sed instead.
     # Or maybe we should use tr instead of sed.

     :0 E  # Else
     { S = "$SUBJ" }

     :0 iw
     | ( sed "s/\$SUBJECT/$SUBJ/g" < $PROCDIR/vacationmsg ;\
         formail -rk -p'> '                                \
                 -I"Precedence: junk"                      \
                 -I"Subject: Out of office [$S]"           \
                 -A"X-Loop: volker out of office" )        \
       | $SENDMAIL $SENDMAILFLAGS -t


This is completely untested, and I'm not sure about my
use of flags, either.

--
Dallman Ross
U.S. Voicemail/FAX: +1 (415) 680-2388
Residence Telephone: +49 (0) 6122 / 98 04 46
Cellular Telephone: +49 (0) 177 / 515 34 69
<dman(_at_)netcom(_dot_)com> ? <dman(_at_)nomotek(_dot_)com> ? 
<dman(_at_)oxon(_dot_)de>

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