Sometime back I suggested the following code to Jeff Grossman:
| > OK, to append:
| > :0fwh
| > * other conditions
| > * ^\/Subject:.*
| > | formail -I "$MATCH end-text"
| > To prepend,
| > :0fwh
| > * other conditions
| > * ^Subject:\/.*
| > | formail -I "Subject: start-text$MATCH"
and Ruud van Tol responded,
| If there was no Subject-headerline, none will be created.
True. If one wants the additional text to become the subject for a message
that has no Subject: header (but which meets the other criteria), one can
do this:
to append:
:0
* other conditions
{
:0fwh
* ^\/Subject:.*
| formail -I "$MATCH end-text"
:0Efwh
| formail -A "Subject: end-text"
}
to prepend,
:0
* other conditions
{
:0fwh
* ^Subject:\/.*
| formail -I "Subject: start-text$MATCH"
:0Efwh
| formail -A "Subject: start-text"
}
Here's another approach:
to append:
MATCH=Subject:
:0fwh
* other conditions
* 1^0 ^\/Subject:.*
* 1^0
| formail -I "$MATCH end-text"
to prepend,
MATCH
:0fwh
* other conditions
* 1^0 ^Subject:\/.*
* 1^0
| formail -I "Subject: start-text$MATCH"