hostname variable in attachment replacement

Randal, Phil prandal at
Thu Aug 6 11:49:14 IST 2009

Julian Field wrote:
> On 06/08/2009 11:09, Erik Bloodaxe wrote:
>> Julian Field wrote:
>>> As clearly shown in the example file supplied in
>>> /etc/MailScanner/reports/en/stored.filename.message.txt,
>>> Note to Help Desk: Look on $hostname in $quarantinedir/$datenumber
>>> (message $id). 
>>> Note the "$hostname" in the line above.
>>> On 06/08/2009 10:13, Erik Bloodaxe wrote:
>>>> Is there a way to have a variable in the attachements that replace
>>>> unacceptable file types and content that expands to the host names.
>>>> I.e. in stored.filename.message.txt in etc/reports/en
>>>> I want a line saying
>>>> File is in: $(HOSTNAME) in $quarantinedir/$datenumber/$id
>>>> so that my sysadmins can see which of the many servers the file is
>>>> on as the standard reports give them no indication of which server
>>>> to get the file from. 
>>>> I have tried all the obvious
>>>> Regards
>>>> Erik
>>> Jules
>> This does not seem to work - $hostname expands to a blank, the
>> enviroment variable $HOSTNAME is set in the environment for login
>> shells but appears not to be set for system started scripts, very few
>> changes have been made to the default install.  This is on RedHat 5.
> Have you set the "Hostname" setting in MailScanner.conf?
> Jules

Here we have:

# Name of this host, or a name like "the MailScanner" if you want to
# the real hostname. It is used in the Help Desk note contained in the
# virus warnings sent to users.
# Remember you can use $HOSTNAME in here, so you might want to set it to
# Hostname = the %org-name% ($HOSTNAME) MailScanner
# This can also be the filename of a ruleset.
Hostname = the %org-name% ($HOSTNAME) MailScanner


Phil Randal | Networks Engineer
Herefordshire Council | Deputy Chief Executive's Office | I.C.T.
Services Division Thorn Office Centre, Rotherwas, Hereford, HR2 6JT
Tel: 01432 260160
email: prandal at

Any opinion expressed in this e-mail or any attached files are those of
the individual and not necessarily those of Herefordshire Council. 

This e-mail and any attached files are confidential and intended solely
for the use of the addressee. This communication may contain material
protected by law from being passed on. If you are not the intended
recipient and have received this e-mail in error, you are advised that
any use, dissemination, forwarding, printing or copying of this e-mail
is strictly prohibited. If you have received this e-mail in error
please contact the sender immediately and destroy all copies of it.    

More information about the MailScanner mailing list