hostname variable in attachment replacement [fixed!]

Randal, Phil prandal at
Fri Aug 7 19:51:59 IST 2009

Hi folks,

I had the "export HOSTNAME" idea just as I was leaving work, with no time to test it, but can now confirm after testing that adding the line

export HOSTNAME 

To /etc/init.d/MailScanner along with all the other exports does indeed fix the problem.


-----Original Message-----
From: mailscanner-bounces at [mailto:mailscanner-bounces at] On Behalf Of Glenn Steen
Sent: 07 August 2009 15:37
To: MailScanner discussion
Subject: Re: hostname variable in attachment replacement

2009/8/7 Julian Field <MailScanner at>:
> On 07/08/2009 15:23, David Lee wrote:
>> On Fri, 7 Aug 2009, Randal, Phil wrote:
>>> Julian Field wrote:
>>>> "$HOSTNAME" shouldn't work in the reports, only in MailScanner.conf.
>>>> But "$hostname" should work in the reports.
>>>> Jules
>>> But it doesn't seem to.
>>> It is a low priority for me at the moment, and my test box is a VM 
>>> at home, so it will take me a while to figure out what's going on.
>>> Cheers,
>>> Phil
>> Hmmm... I think there are many of us here on this list who are 
>> expecting the variable to have been automatically set prior to the 
>> point of use with a reasonable default (e.g. from "uname -n" or 
>> "/bin/hostname" or similar) but who are finding it empty/unset.  
>> (There may well be others here, for whom a default is being set.)
>> The human expectation and the computer-code reality don't marry up; 
>> something somewhere (either human or machine) is going astray.
>> Wouldn't it help if the MS start up code could have something like:
>>   if not set/inherited ... then set to something '/bin/hostname'-ish.
> I could put it in the init.d script I guess. That would be the right 
> place for it. MailScanner just automatically looks up $ENV{FOOBAR} 
> when it sees $FOOBAR or ${FOOBAR} in the MailScanner.conf file, it 
> doesn't know about the hostname as a special case at all, and I would like to keep it that way.
> Jules
Since the /etc/network file get sourced, it is already there. The question is if you might need an "export HOSTNAME" just after it, to make sure the children get it... But then again, if that was needed, my systems wouldn't be working... and they are;-).

-- Glenn
email: glenn < dot > steen < at > gmail < dot > com
work: glenn < dot > steen < at > ap1 < dot > se
MailScanner mailing list
mailscanner at

Before posting, read

Support MailScanner development - buy the book off the website! 

More information about the MailScanner mailing list