I rewrite the subject line for certain incoming mails depending on TO: field:
:0fhw
* ! ^TO_user@domain\.com\>
* ^TO_[^<>@ ]+@domain\.com\>
* ^Subject:\/.+
| /usr/local/bin/formail -I"Subject: [SPAM]$MATCH"
The above code (from my earlier question procmail rewrite subject line if email recipient user fails match test) works perfectly - if I get mail from something OTHER THAN user@domain.com, the subject line is rewritten as [SPAM] (original subject)
But I would like to do multiple conditionals like this - the working block, above, will be the final one, but before that, I'd like to rewrite the subject line if the TO matches a different address.
So I added this block just above it:
:0fh
* ^TO_special@domain\.com
* ^Subject:\/.+
| /usr/local/bin/formail -I"Subject: [SPECIAL]$MATCH"
$DEFAULT
... and this works - emails sent to 'special@domain.com' get their subject line rewritten.
The problem is, Procmail doesn't stop - it moves onto the next block and rewrites it again. So emails sent to special@domain.com
get their subject lines rewritten as:
[SPAM] [SPECIAL] Original subject line blah blah
Why is this? Why doesn't the $DEFAULT
action at the end of the first block cause Procmail to halt processing for that piece of email?
How can I match the new block and stop processing that piece of mail and just be done with it?