On Thursday 02 August 2007 00:29, D. Dante Lorenso wrote:
> When email is targeted at certain mailboxes (mailing lists), I'd like to
> rewrite the message subject to either prepend or append some text if the
> subject does not already contain that text as a substring.  This way,
> mail that goes through the list will be stamped with something like
> '[LISTNAME] original subject'.
>
> Does anyone have any pointers on how I can most easily do this?

There's the headers_add and headers_remove router (and transport) options. See 
<http://www.exim.org/exim-html-current/doc/html/spec_html/ch44.html#SECTheadersaddrem>.

  headers_remove = Subject
  headers_add = Subject: [foo] $rh_Subject:

Mail copies with equal header additions and removals are automatically grouped 
together.

Note the $rh_. The data you give to add_header is not further encoded (i.e. 
RFC 2047) by Exim. You want to skip adding [foo] it it's already in the 
subject. Use the decoded version, $h_Subject:, to check that. You have to use 
the same condition both in headers_remove and headers_add.

Consider looking up all fields at the same time and using address_data to 
store them. See address_data i chapter 15 for an example.

You might also consider _not_ tagging the subject. Most MUAs can automatically 
sort list mail into separate folders, making this kind of tags rather 
unnecessary.

-- 
Magnus Holmgren        [EMAIL PROTECTED]
                       (No Cc of list mail needed, thanks)

  "Exim is better at being younger, whereas sendmail is better for 
   Scrabble (50 point bonus for clearing your rack)" -- Dave Evans

Attachment: pgpt9KX74n5Y8.pgp
Description: PGP signature

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to