procmail
[Top] [All Lists]

Re: Hacking stdin? (Why doesn't this filter do what I expect)

1997-05-08 04:47:00
On Thu, 8 May 1997 06:35:27 -0400 (EDT),
Robert Nicholson <steffi2(_at_)dgs(_dot_)dgsys(_dot_)com> wrote:
What's not rfc822 about it?

This is what I see: 

---- next item --
Content-Type: message/rfc822

testing

---- next item ----

This is something like what I'd like to see:

---- next item --
Content-Type: message/rfc822

Some-header: Now we have a header

A message body

---- next item ----

The lack of at least a From Subject or Date header before the body?

I'm not reading RFC 822 just to check the specs but I'd say that
without any sort of header, the "body" is taken to be the header, and
found invalid. Anyhow, aren't you supposed to be including the entire
message you're bouncing? (Wasn't that how this thread started?)

You mean lose the echo's? Perhaps I'll compromise and just put them in a
here document or something :-) Point taken though.

You can additionally do all of the filtering in a single recipe, and
save a whole lot of unnecessary processes (two cats, a sick number of
echos, at least one sed). All of these can be handled by a single sed
script.

Protoptypical example, I'll leave the implementation to you: 

    :0
    * conditions, maybe? 
    | sed -e 'sed script to duplicate the header' \
          -e 'sed script to insert preable and other cruft in front' \
          -e 'sed script to insert postamble cruft at the end' \
      | formail -bk -rtz -switches .... | $SENDMAIL $SENDMAILFLAGS -t

If you think you need help with fleshing this out, feel free to ask --
but please do it either on the list or in private, not both, OK? 
(I'd imagine the list has seen enough of this thread already. Perhaps
you can summarize on the list with a working solution when you've
figured it out. The MIME stuff is not strictly on-topic on the list,
either.) 

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>