Unfortunately there is no built-in method for logging the helo_data variable to the mainlog file.
The method I would probably use would either to be to add a hook somewhere within the message path to log the data I am looking for to another file with some reference to point back to the entries in the mainlog file (say the message ID), or I would set up a separate router & transport on a per-website basis. The transport used to send the mail is logged in the mainlog file as the T=my_transport value.
For the custom logging I have managed to do something similar for inserting of received email details into a database using the condition =
value in the router. You could use the ${run{<command> <args>}}
string expansion to achieve this:
condition = ${run{/path/to/interpreter /path/to/custom/logging/script $sender_domain $message_exim_id}{1}{0}}
(untested)
That little snippet in the router will execute the script /path/to/custom/logging/script
using the interpreter /path/to/interpreter
(/bin/sh, /usr/bin/perl, whatever) passing it the domain name of the sender and the Exim message ID.
It's fairly heavyweight, so wouldn't be ideal on a heavy usage server, but it might just work....
How are you telling exim to switch between the helo_data values? – Majenko – 2011-03-27T19:53:30.567
Since each value of helo_data needs its own ip (interface) I am assigning a value to interface based on the value of $sender_address_domain. If a particular domain has more than one interface that pertains to it, it will chose one at random. After interface is assigned, it then uses the value of $sending_ip_address to chose the correct value for helo_data. The solution sounds convoluted but it works and is only minimally complicated. A script writes the appropriate config strings so it is not "hard to maintain" either. Not enough room in this response, I'll post code snippets after. – Radmilla Mustafa – 2011-03-27T20:00:48.907
interface = ${extract{$sender_address_domain}{one.com=${extract{${eval:1 + ${randint:2}}}{:}{10.1.0.1:10.1.0.2}{$value}{10.0.0.0}} two.com=10.2.0.1 three.com=10.3.0.1}{$value}{10.0.0.0}}
helo_data = ${extract{$sending_ip_address}{10.0.0.0=mail.default.com 10.1.0.1=mail1.one.com 10.1.0.2=mail2.one.com 10.2.0.1=mail.two.com 10.3.0.1=mail.three.com}{$value}{mail.default.com}}
– Radmilla Mustafa – 2011-03-27T20:05:44.193I assume this is done within the transport section? – Majenko – 2011-03-27T20:20:49.353
yes, within the transport. It has been pretty thoroughly tested and it works as expected. – Radmilla Mustafa – 2011-03-27T20:26:08.140