However, one can add a Content-Length: header with everyone's favorite
tool, procmail. :) Here's a recipe borrowed from David Tamkin about
9 moons ago:
:0fhw # B won't help; size conditions ignore H and B flags on the :0 line
* ! ^Content-Length:.*[0-9]
* 1^1 B ?? >1
| formail -a "Content-Length: $="
If procmail is used as your local delivery agent (which I believe is
the norm for various Linux distributions), couldn't it be configured
to add the Content-Length during local delivery?
Yup... But if you pipe directly from a sendmail alias the delivery
agent isn't called, so people need to be careful.
If any one can confirm the sendmail.cf syntax to do such a thing,
I could add it to the FAQ dealing with the split message problem.
The only way that I know of is to add the line
to your sendmail.cf file. Whenever procmail is invoked, it will
automatically correct this bad Content-Length: header. But that's
ugliness and will probably break things even more in situations where
procmail isn't called.
To quote from the sendmail "Bat" book, p. 795:
The Content-Length: header describes the approximate size of the
body of a message. The size is always a decimal expression of the
number of bytes occupied by the body.
It is used by some MUAs to find a message faster in a large file of
many messages. It is always created or added by MUAs or delivery
agents and never by MTAs. It should never be declared in the
For Sun's version of V8 sendmail the behavior of the Content-Length:
can be traced with the -d80 debugging switch (see S37.5.190). All
other version of sendmail ignore this header.