I just converted my use of a system filter for rewriting the Subject line to
doing it in a transport and during debug testing to ensure it worked,
noticed this:
26450 removed header line:
26450 Subject: one two three!
26450 ---
26450 added header line(s):
26450 Subject: one two three!---
The "---" is what caught my eye. The message I sent was done via simple
telnet and I just typed in fake headers including a Subject: header, hit
enter (and enter again to finish headers - Subject: being the last header
before the body) typed in the body and finished the email. As you can see
when Exim got the Subject header it seems to have had a newline at the end
(or Exim put one there when printing this debug info out), however after it
was rewritten using in the transport with:
headers_remove = Subject
headers_add = Subject: ${if and {{first_delivery} {eq
{$header_X-Spam-Flag:}{YES}}} {*SPAM* $bheader_Subject:}{$bheader_Subject:}}
You can see that Exim didn't print the new Subject header with an apparent
newline at the end. Now, it caused no problems to the actual message in
transit - the subject was fine and nothing seems out of whack, so it's more
of just a "hm, lookit that...", though I do wonder if technically it should
have a newline added?
Adding a "\n" at the end of the headers_add line causes the output to look
as I'd expect it to:
412 removed header line:
412 Subject: one two three!
412 ---
412 added header line(s):
412 Subject: one two three!
412 ---
Should I append a forced newline in my headers_add line even though it seems
to make no difference? Exim docs only mention separating multiple headers
in a headers_add with \n, not that it has to terminate as well. Just
curious. Oh, and I have no idea if rewriting in a filter file causes
similar functionality as I couldn't figure out how to have Exim show what it
was doing as it processed the system filter.
Eli.