procmail
[Top] [All Lists]

Re: Sending Multiple lines of text in a recipe

2000-02-25 02:41:28
On Thu, 24 Feb 2000 10:00:08 -0500, Michael DeMutis <mike(_at_)2gen(_dot_)net>
wrote:
:0 f
* ^TOinfo(_at_)2gen(_dot_)net
{
        :0 h c
        * !^FROM_DAEMON
        * !^X-Loop: info(_at_)2gen(_dot_)net
        | (formail -r -A"Precedence: junk" \
        -A"X-Loop: info(_at_)2gen(_dot_)net From: 2Gen.Inc. 
<info(_at_)2gen(_dot_)net> Reply-To:
Ed Kopas <ed(_at_)2gen(_dot_)net>" ; \
        cat /usr/home/mike/autores/info.txt) | /usr/sbin/sendmail -t
}

You don't need the f (what's that for?) or the braces. You put in
multiple headers by passing multiple -A (or perhaps in this case
preferrably -I) options. And you should probably be using formail -rt.

    :0 h c
    * ^TOinfo(_at_)2gen(_dot_)net
    * ! ^FROM_DAEMON
    * ! ^X-Loop: info(_at_)2gen(_dot_)net
    | ( formail -rt -I "Precedence: Junk" \
                    -I "X-Loop: info(_at_)2gen(_dot_)net" \
                    -I "From: 2Gen.Inc. <info(_at_)2gen(_dot_)net>" \
                    -I "Reply-To: Ed Kopas <ed(_at_)2gen(_dot_)net>" \
        ; cat /usr/home/mike/autores/info.txt ) \
      | $SENDMAIL $SENDMAILFLAGS -t

Also note the use of a parametrized $SENDMAIL

How do I specify a line break in the line of text that I'm sending.

This is a valid question in and of itself. Procmail treats a single
backslash on a line of its own in the action part as a newline. So you
could say

    :0  # this does not work
    * conditions ...
    | formail -A "Precedence: junk\
\
X-Loop: info(_at_)2gen(_dot_)net\
\
From: 2Gen.Inc. <info(_at_)2gen(_dot_)net>\
\
Reply-To: Ed Kopas: <ed(_at_)2gen(_dot_)net>"

but I wouldn't trust this to work with any old version of Formail.

(I didn't expect it to work at all, but it does work with the version
I have here. But I would guess it's "thinking" it's adding a
multi-line Precedence: header and not noticing the other headers in
the string. This is not what you want for any other option than -A --
it would produce the wrong behavior for -I and -a and -i.)

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition

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