procmail
[Top] [All Lists]

Re: Rewriting From: and Subject:

2000-09-19 08:33:59
Florian asked,

| I want to rewrite the From:-Field of a Mail, but I want to append the
| old From: to the subject....
| 
| I tried this, but it only moves the mail into "osubj"...
| 
| :0fh
| * Subject: \/.*
| osubj = $MATCH
| * From: \/.*
| | formail -I "From: niemand(_at_)nirgends(_dot_)de" -I "Subject: Wichtig: 
$osubj"

| Whats my mistake ???

Well, you're trying to make an assignment the action of a recipe, and
you're trying to start a second recipe without a colon line, and you're
trying to put flags for the second recipe on the colon line for the first
one.  Also, you're setting MATCH a second time and not using the value,
and to make sure you don't get false matches on the contents of other
headers, you should left-anchor the Subject: and From: conditions.

This might do what you want:

 :0fh # you might want `W' or `w' as well
 * ^Subject:\/.*
 | formail -i "From: niemand(_at_)nirgends(_dot_)de" -I "Subject: 
Wichtig:$MATCH"

The original From: will be renamed Old-From: and "Wichtig:" will be inserted
into the subject.  The recipe will fail, though, if the incoming message has
no Subject: line.  (With an empty one with just the word "Subject:" it will
still work.)


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>