procmail
[Top] [All Lists]

Re: Folding E-mail Headers

2006-04-20 22:43:48
Hi Bart,

Thanks for taking the time to lead me through the steps. I will admit to being 
poor at documenting my attempts prior to pulling out my hair, so if it looked 
like I made only one attempt (and a poor one at that), I apologise. I see the 
mistake in my original post and you are, of course, correct. However, that was 
just one of the steps I tried, and my main problem or lack of understanding 
revolved around calling multiple shell utilities and getting them to work 
together. You have done a great job of showing me how to do that.

My apparent misunderstanding of Internet message headers was actually a 
misunderstanding of what "fold" would do -- perhaps a result of confusing the 
utility with the word "fold" used wherever I read it as it related to "folding" 
long message headers.

Anyway, I tried your suggestions -- both fold+sed and fmt. Both worked and I've 
decided to use the fmt solution, although I will keep your warning in mind.

Much appreciated to the three of you who took the time to respond.


Craig


At 2006:04:20 21:28 -0700, Bart Schaefer wrote:
On 4/20/06, Craig <craig(_at_)0604(_dot_)zuym(_dot_)com> wrote:

Sorry, I'm more confused than I was before!

Let's start back at the beginning: "fold" requires either a file name
as a command-line argument, or a stream of text on standard input. 
The first problem you ran into was because you tried to give "fold" a
long string of text as a command-line argument; worse, you failed to
quote the string of text, so it was divided into separate arguments at
spaces, and fold tried to interpret each of the words in the string as
a separate file name.  These are pretty basic shell programming
mistakes, and if you want to write procmail recipes beyond the very
simplest you should probably start by getting some background in using
the shell, because a lot of the syntax rules used by procmail are
borrowed from the shell language.

The next most basic problem that you're having is that you don't
understand the format of internet message headers.  A header that's
folded onto multiple lines must have every line after the first one
begin with a whitespace character (usually tab, but space is OK too). 
So it is not sufficient to do what "fold" does to the long string; you
must also insert that leading space on every line that is output by
"fold".  Not doing so is why, when you used Gerald's suggestion, you
ended up with the second and succeeding lines inserted into the
message body instead.




____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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