procmail
[Top] [All Lists]

Re: get rid of 'From '-"Header"

2001-06-29 18:09:33
"David W. Tamkin" <dattier(_at_)ripco(_dot_)com> writes:
...
I see from your subsequent post that you found a solution by having formail
remove From_ and pipe the output to cyrdeliver, but another way, without
running formail (nor a shell to set up the pipe) might be to use procmail's
`r' flag for raw mode.  In raw mode, procmail does not care if the message
doesn't have a From_ line or doesn't have a closing blank line and won't add
them if they're not already there.

If at that point in your .procmailrc the message already has a From_ line
that you need to remove, though, raw mode won't help.

Your description of raw mode is not quite accurate.  The 'r' flag tells
procmail to _not_ do four things:

1) put a '>' before any line in the body that starts with "From "
2) add a single newline to the end if it doesn't end in two newlines
3) force an access time earlier than the modification time
4) if configured with custom message delimiters (ala MMDF) 
   write those out before and after the message itself

By default, procmail does all of those when writing to an mbox-style
folder.  When writing to other folder styles or to a pipe, procmail
automatically disables some of those.  In particular, when writing to a...

pipe,                   only do (2)
MH folder,              only do (2)
directory folder,       only do (2)
maildir,                do none of them

So yes, the 'r' flag has no effect when writing to a maildir.


As for the leading "From " line, procmail will _automatically_ leave it
off line when writing to a maildir folder, but there's currently no other
way to tell procmail to not write out that line.  Arguably, procmail
shouldn't be writing out such a line to MH folders either and it would
be nice to have a flag (R?  F?) that would disable it for other cases.
For now you have to use the
        formail -b -I"From "
bit.  (The -b flag tells formail to not escape embeded "From " lines.)


Note that whether the message starts with a leading "From " line is yet
another point to consider.  The message being processed by procmail will
initially have such a line if
a) the message fed to procmail had one, OR
b) procmail was invoked with the -f flag, OR
c) procmail is in delivery mode (invoked with the -d flag, the -z flag,
   or via a name that doesn't start with procmail)


The details above are for version 3.20.  Previous versions did (2) for
maildir folders, and there may be other differences that I can't remember.


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