You basically need shell access on the mail server in order to run Procmail there. If you do have the required privileges, doing what you are asking is simple, though your requirements are mildly unclear.
I'll assume that you want to add
[groupname] to messages from
email@example.com if it's not already present.
* ^From: groupname-list@example\.net\>
* ! ^Subject:( Re:)? *\[groupname]
| formail -I "Subject: [groupname]$MATCH"
f flag says to modify the header by filtering through the pipeline in the action; the
h means the action applies to the header only (to reduce the amount of data to copy unmodified back and forth); and the
w says to check that the action is successful.
\/ special regex token causes the match after it to be captured to the special variable
Because dot and left square bracket are regex metacharacters, we need a backslash to match them literally. The
\> word boundary ensures that
net is not a partial match in a longer address (say
...@example.netcom.whatever) though it's not entirely foolproof (it would still match on
...@example.net.uk for example).
Anyway, you'll need to replace the first condition with something which matches exactly on a header in the messages you are targeting. For example, the one here doesn't match
From: List Name <firstname.lastname@example.org> (because the regex doesn't contain an expression to skip the text up through the
The rest should be trivial to understand, I hope.