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.
Configuring hMailServer to use an external virus scanner
This example shows how to set up hMailServer to use AVG Free 7. It assumes you have AVG Free installed in C:\Program Files\Grisoft\AVG Free
- 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 (") should be included
"C:\Program Files\Grisoft\AVG Free\avgscan.exe" /EXT=* /NOBOOT /NOMEM /SCAN /NOSELF /NOHIMEM /ARC "%FILE%"
6 as the return value. (
Avgscan.exe will return a value of 6 if a virus is found.)
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.
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 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.
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.
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.