[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.6.5 Modifying Messages

The action command modify allows to alter the headers or the body of the message.

Command: modify [flags] header `['key`]' `['new-key`]'
Command: modify [flags] `['key`]' `['new-key`]'

For each header whose name matches key, replaces its name with new-key. If key is a regular expressions, new-key may contain back references. For example, the following statement will select all headers whose names start with `X-' and change their names to begin with `X-Old-':

 
modify header :re ["X-\(.*\)"] ["X-Old-\1"]

Command: modify [flags] header `['key`]' value
Command: modify [flags] `['key`]' value

For each header whose name matches key, changes its value to value. For example:

 
modify [Subject] "New subject"

This statement sets the new value to the Subject header.

Every occurrence of unescaped `&' in the new value will be replaced by the old header value. To enter the `&' character itself, escape it with two backslash characters (`\\'). For example, the following statement

 
modify [Subject] "[Anubis \\& others] &"

prepends the Subject header with the string `[Anubis & others]'. Thus, the header line

 
Subject: Test subject

after having been processed by Anubis, will contain:

 
Subject: [Anubis & others] Test subject

Command: modify [flags] header `['key`]' `['new-key`]' value
Command: modify [flags] `['key`]' `['new-key`]' value

Combines the previous two cases, i.e. changes both the header name and its value, as shown in the following example:

 
modify header [X-Mailer] [X-X-Mailer] "GNU Anubis"

Command: modify [flags] body `['key`]'
Removes all occurrences of key from the message body. For example, this statement will remove every occurrence of the word `old':

 
modify body ["old"]

Command: modify [flags] body `['key`]' string
Replaces all occurrences of key with string. For example:

 
modify body :extended ["the old \([[:alnum:]]+\)"] "the new \1"


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Wojciech Polak on December, 18 2004 using texi2html