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.

Configuring hMailServer to use an external virus scanner

This example shows how to set up hMailServer to use AVG Free. It assumes you have AVG Free installed in C:\Program Files\Grisoft\AVG Free.
  1. Start hMailServer Administrator
  2. Navigate to Settings -> Protocols -> SMTP -> AntiVirus
  3. Select the External virus scanner page.
  4. Select Use external scanner
  5. Specify the following command line. The quotation marks (") should be included:
    "C:\Program Files\Grisoft\AVG Free\avgscan.exe" /EXT=* /NOBOOT /NOMEM /SCAN /NOSELF /NOHIMEM /ARC "%FILE%"

  6. Enter 6 as the return value. (Avgscan.exe will return a value of 6 if a virus is found.)

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


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

Search documentation