I am have a transport setup in Exim and I which to add a special header for certain users - and for the rest a different header value. I have attempted create the correct syntax for adding this header but are having some problems.

The current code I have is:

headers_add = X-SenderTest: {${lookup{$sender_address}lsearch{/etc/addresses}{header1}{header2}}}

So if a $sender_address is in the file /etc/addresses (just a list of new line e-mail addresses) I want the following header:

X-SenderTest: header1

and for all other $sender_address I want:

X-SenderTest: header2

However what I actually get is:

X-SenderTest: {header1} or 
X-SenderTest: {header2}

I have tried multiple combinations of removing the { brackets but without any luck getting a various amount of syntax errors.

For example the following:

 X-SenderTest: {${lookup{$sender_address}lsearch{/etc/probanalogin}Prob no-Prob}}

gives this syntax error:

failed to expand headers_add or headers_remove: missing or misplaced { or }

Any help would be greatly appreciated.

  • Have you added the header in the transport?
    – Kondybas
    Nov 16, 2015 at 6:27

1 Answer 1


Remove the outer brackets. Your line should look like:

headers_add = X-SenderTest: ${lookup{$sender_address}lsearch{/etc/addresses}{header1}{header2}}

The extra brackets were being added verbatim to the header.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .