The Exim FAQ

Contents   Previous   Next

9. HEADERS

Q0901:  I would like add some custom headers to selected outgoing mail based on a specific domain and the subject line.

A0901:  To the remote_smtp transport, add something like

   headers_add = ${if and{\
                 {eq{$domain}{spec.dom}}\
                 {matches{$h_subject:}{whatever}}}\
                 {Content-Type: text/html; charset="us-ascii"} fail }

This example shows a Content-Type: header, but you can have anything you like, and multiple headers can be inserted by using \n to separate them.

Q0902:  Is it possible to have Exim add a header to only certain local parts of outgoing mail?

A0902:  Only if you arrange for each such local part to receive its own private copy of the mail. See max_rcpt in the SMTP transport. If you set this to 1, you could use conditions in an expansion string to add or not add a header.

Q0903:  How can I remove some part of the Received: header?

A0903:  Set received_header_text.

Q0904:  How I can insert the PGP header line using Exim filters?

A0904:  You can't insert headers in a user filter. A system filter can do so, but the inserted lines then are included for all recipients.

Q0905:  I know I can use a system filter to replace certain headers in messages, but how can I add text to existing headers? I want to add [SPAM] to the subject line of messages that appear to be spam.

A0905:  You can only do this in a round about way, using filter commands like this:

   headers add "New-Subject: SPAM: $h_subject:"
   headers remove subject
   neaders add "Subject: $h_new-subject:"
   headers remove new-subject

This trick works only in system filters, where the commands are obeyed in order, and affect the master list of headers that apply to the whole message. You cannot do this with the headers_add and headers_remove options on drivers.



Contents   Previous   Next