Just to get this into the archives, I finally got around to looking into adding the square brackets into the header. This is how to do it for anyone who might like to do it.
This changes the Received line from :- Received: from x (HELO x.x.x) (x.x.x.x) to Received: from x (HELO x.x.x) ([x.x.x.x]) --- ./received.c 1998-06-15 18:53:16.000000000 +0800 +++ ../../../netqmail-1.05/netqmail-1.05/received.c 2008-09-28 20:07:14.226463651 +0800 @@ -60,8 +60,9 @@ safeput(qqt,remoteinfo); qmail_puts(qqt,"@"); } + qmail_puts(qqt,"["); safeput(qqt,remoteip); - qmail_puts(qqt,")\n by "); + qmail_puts(qqt,"])\n by "); safeput(qqt,local); qmail_puts(qqt," with "); qmail_puts(qqt,protocol);