[EXIM] Headers add/remove

Top Page
Delete this message
Reply to this message
Author: John Horne
Date:  
To: exim-users
Subject: [EXIM] Headers add/remove
Hello,

As a special one-off case I was trying to get our system filter (a perl
script) to strip out the Reply-to:, From: and To: headers from a trapped
(frozen) message, and then replace the From: header with something else.
Sounds weird, but as far as I could tell it should be possible.

I had something similar in the system filter to:

headers remove Reply-to
headers remove From

   headers add "From: ${lookup {${substr_4:${local_part:$h_To:}}} lsearch
                         {replies} {$value} {postmaster@???}}\\n"


headers remove To
freeze

However, the file lookup fails. If I remove the 'headers remove To' line then
it works. Am I missing something here or isn't the script being executed
sequentially?

Secondly, since the above results in no recipients being shown by my mail
agent, I thought I would add a blank Cc: header. I added to the end the line
'headers add "Cc:"'. I ended up with:

      Cc: From: postmaster@???


and no recipient address being shown (since the From: had now gone).

If I changed it to 'headers add "Cc:\n"' then I get:

      Cc:
      Cc: 


I also noticed that since the message was frozen eximon showed the From:
header to have been rewritten (using the 'headers' mouse action on the
message) and with the correct (!) address from the file lookup. When I forced
the message to be delivered it appeared as 'From: postmaster@???'.

So what's going on? This is with Exim 2.01. My mail agent is XFMail which
may/may not be confusing things, but (up till now) has worked fine.

(I got round the whole problem by explicitly putting the headers in, sending
the message, and then ripping it all out again.)

John.

-----------------------------------------------------------------------------
John Horne                                     E-mail: J.Horne@???
Academic and Information Services              Phone :  +44 (0) 1752 - 233911
University of Plymouth, UK                     Fax   :  +44 (0) 1752 - 233919



--
*** Exim information can be found at http://www.exim.org/ ***