procmail
[Top] [All Lists]

Re: Adding a header - at a certain location within the headers

2003-02-21 03:55:13
On Thu, Feb 20, 2003 at 09:43:45AM -0500, S. Morgan Friedman wrote:

[T]he subject line [. . .] contains two carriage returns -- therefore,
when you append a new header via procmail, the e-mail browser does
not detect it as a header (the extra blank line after subject makes
it think that the headers have ended and the content of the e-mail
begins). [. . .]

To tag mail as spam, I'm just using the simple formail:

| formail -I "X-SMF-Cat: Spam; final filter"

So my question for you all is this: I want solve this problem and
one way that comes to mind is inserting the header after a certain
point in the headers (such as, after the "Delivered-To:" header, which
all messages have) so it is not after the final subject. Or another
possibility is to delete the extra carriage return from the subject
header, if it has contains an extra one. Unfortunately, I do not know
how to do either of these.

It seems easier to me to edit the existing Subject than to reorder
lines.  Use formail, which you're calling already.  For example:


 :0 fhw
 * ^\/Subject:.*
 | formail -I"X-SMF-Cat: Spam; final filter" \
           -i"Subject: $MATCH"

Would replace any multiline Subject: with the first line only,
and rename the existing one to Old-Subject:.

However, I can't reproduce your problem, and I don't think, if
you are using the `h' option to formail, it would have any such
problem with the bottom header.  Could the newlines actually be
control chars?  ^M's?

More easily, you might as well trash anything with Subject:
matching that pattern.

        * Subject:.*$^$

should match if it's really Subject: at the bottom followed by two
blank lines.

-- 
dman

_______________________________________________
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>