External antivirus scanner


hMailServer has built-in support for the Open Source antivirus software, ClamWin. To use a different virus scanner, apply the External virus scanner feature. It enables you to run any anti virus scanner that supports command line scanning. In the Scanner executable - field, you specify the command line that should be used when scanning. In the Return value - field, you specify the value that the virus scanner will return when a virus is found. This value varies depending on the virus scanner. See the bottom of this page for a list of virus scanners and their command lines.

A useful tip. If you use the macro %FILE% in the command line, hMailServer will replace %FILE% with the full path to the file that needs to be scanned.


This example shows how to set up hMailServer to use AVG Free in hMailServer 4.0 build 85 and later versions. It assumes you have AVG Free installed in C:\Program Files\Grisoft\AVG Free.
  1. Start hMailAdmin and navigate to Settings -> Protocols -> SMTP -> AntiVirus
  2. Select the External virus scanner page.
  3. Select Use external scanner
  4. Specify "C:\Program Files\Grisoft\AVG Free\avgscan.exe" /EXT=* /NOBOOT /NOMEM /SCAN /NOSELF /NOHIMEM /ARC "%FILE%" as the command line. The quotation marks (") should be included.
  5. Enter 6 as the return value. (Avgscan.exe will return a value of 6 if a virus is found.)


  • The %FILE%-macro functionality only applies to hMailServer 4.0 build 85 and later.

Scanner command lines

Virus scanner Command line Return value
AVG Free "C:\Program Files\Grisoft\AVG Free\avgscan.exe"

Testing it

Since testing with real viruses is risky, you can use the Eicar anti-virus test file. It is treated as a virus by anti-virus scanners, but is safe to use since it is not a real virus. These sites enable you to send out email containing the Eicar anti-virus test file:

More information

Search documentation