I need some help with my recipe. It is supposed to append a line
to the top of the message body and forward a copy of any mail
sent to webmaster(_at_)usatfne(_dot_)org to my e-mail address at work. I
receive the forwarded mail at work but the appended line is missing.
I'm puzzled because, until I made some "simple changes", the
line did appear. The same code seems to work on my account (at
a different ISP.) Here's the recipe:
| cat - ; \
echo "======= Forwarded Mail from webmaster(_at_)usatfne(_dot_)org
There's a high probability that the problem is that the message being
handled is a MIME multipart message. In such a message, the top of the
message body, before the first multipart boundary, is not part of any
content in the message and anything put there is ignored by programs
that understand MIME.
To verify that this is the problem you'll need to look at the raw message
header. If the message header contains a header field "Content-Type:"
whose value starts with "multipart/", then that's the problem.
I don't really have any good suggestions for how to solve the problem.
If you can find a program that can prepend text to multipart messages then
that will solve the problem. Alternatively, you could strip the MIME
headers (Content-* and Mime-Version:) and turn it all into plain text,
but that'll leave any message with multiple parts very difficult to read.
Probably the best solution is to instead add a header field that indicates
that it was forwarded and then tell you MUA to flag those messages in
some way, but that require magic from your MUA that it may or may not
be able to perform.
BTW: you really didn't need to send your question to the procmail list
twice. What's ironic is that the second copy you sent is a multipart
message, such as what would cause problems with your forwarding recipe.
procmail mailing list