procmail
[Top] [All Lists]

Re: Adding body to autoresponder

2000-01-15 03:57:58
On Fri, 14 Jan 2000 09:53:35 -0600, Randyman <Randyman(_at_)tcgdata(_dot_)com>
wrote:
I can set up autoresponders just fine.... what I would like to be
able to do is to also capture the body of the incoming message and
place that in the return email along with the text file that I will
be sending back.

The basic answer is to use formail's -k option. (And then you have to
lose the h flag, of course.)

I am not concerned with any attachments which may be associated
with the incoming mail. Only the message body.

Is this supposed to mean, "I don't worry too much if I will quote back
any attachments, too", which is easy, or "I wouldn't want to", which
is hard? See Rik's recent message about MIME attachment handling --
that should give you an idea of the complexity of the latter.

(People tend to believe that messages have a "main part" and
"attachments" but MIME doesn't enforce any hierarchy like that -- a
multipart message has multiple parts, period. Some of them really are
"attachments" to other parts but that's not something a computer can
figure out from the MIME structure.)

:0 hc
* ^TONoSpam
* !^FROM_DAEMON
* !^X-Loop: .*
| (formail -r -t -A"Precedence: junk" \
    -I"From: Postmaster <whatever(_at_)domain(_dot_)com>" \
    -A"X-Loop: NoSpam(_at_)domain(_dot_)com" ; \
    cat $HOME/uce.txt ) | $SENDMAIL -t

So... this works fine. But I would like to grab the original
message text and place it along with the uce.txt file and send that
back to the original sender.

Try this instead:

    :0c
    *   ^TO_NoSpam
    * ! ^FROM_DAEMON
    * ! ^X-Loop: NoSpam(_at_)domain\(_dot_)com
    | formail -k -rt -A "Precedence: junk" \
            -I "From: postmaster <whatever(_at_)domain(_dot_)com>" \
            -A "X-Loop: NoSpam(_at_)domain(_dot_)com" \
      | sed -e '1,/^$/!b' -e '/^$/r'" $HOME/uce.txt" \
        | $SENDMAIL $SENDMAILFLAGS -t

Notice the various minor modifications, too; ^TO_ instead of ^TO, full
X-Loop: checking instead of just checking for any old X-Loop header.

This is the harder solution -- if you just want to attach uce.txt
after the whole hoopla, use ( formail ; cat uce.txt ) instead of
formail | sed

If you [also] want to keep the original headers, there are some
pointers to solutions at <http://www.iki.fi/era/procmail/links.html>
in the "Pearls" section.

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>