hMailServer has built-in support for the open source antivirus software, ClamWin. To use a different virus scanner, use the 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. 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.
Note: ClamWIN should NOT be used on a busy server as it is NOT Multithreading. Use ClamAV instead.
When a virus is found
Choose Delete e-mail if you want messages containing a virus to be deleted immediately. Chose Delete attachments if you want messages containing viruses to be delivered, but that attachments should be removed. When deleting the email, you can chose to notify the sender and/or recipient of the email that a virus was found in the email.
Maximum message size to virus scan (KB)
Most email message which contains viruses are relativly small. Using this setting, you can configure hMailServer to skip virus scanning if a message is larger than a specified size.
hMailServer can be set to use an external ClamAV instalation. Specificy the Host Name or Static LAN IP address and the port for your ClamAV instalation. Standard port is 3310.
The test button will generate a EICAR test virus and send it to your ClamAV, and detail the response provided by your ClamAV installation.
hMailServer can be automatically configured to use ClamWin. To automatically configure hMailServer to use ClamWin, click Autodetect. hMailServer will read ClamWin settings from the Windows registry. After the settings have been autodetected, you should make sure that they are correct.
Please note that ClamWin must be installed prior to doing this. ClamWIN should NOT be used on a busy server as it is NOT Multithreading. Use ClamAV instead.
External Virus Scanner
The path to the anti virus scanner executable that should be run. This should be a command line scanner that does not have a user interface. See below for further detail and examples on how to configure an external virus scanner.
The value that the virus scanner will return if a virus is found.
These settings allows you to block attachments based on the attachment extension. If you enable this feature, hMailServer will remove the attachment and then add a new attachment with the name <original name>.txt which contains a short message that the attachment has been removed.
Configuring hMailServer to use an external virus scanner
This example shows how to set up hMailServer to use AVG Free 16. It assumes you have AVG Free installed in
32 bit Windows -C:\Program Files\AVG
64 bit Windows - C:\Program Files (x86)\AVG
- Start hMailServer Administrator
- Navigate to Settings -> Protocols -> SMTP -> AntiVirus
- Select the External virus scanner page.
- Select Use external scanner
the following command line. The quotation marks (") must be included
For 32 bit Windows =
"C:\Program Files\AVG\Av\avgscanx.exe" /Scan="%FILE%" /EXT=* /ARC /PRIORITY=HIGH, or for
64 bit Windows =
"C:\Program Files (x86)
\AVG\Av\avgscana.exe" /Scan="%FILE%" /EXT=* /ARC /PRIORITY=HIGH
5 as the return value. (
avgscanx.exe/avgscana.exe will return a value of 5 if a virus is found.)
Note: avgscana.exe is a 64-bit component where avgscanx.exe is a 32 bit component, but will also work on 64 bit systems.
Scanner command lines
For more examples on virus scanner comma lines, see the example list
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:
- The %FILE%-macro functionality only applies to hMailServer 4.0 build 85 and later.