Follow the instructions in our manual to add our package repository and then run the below command.
apt-get install halon-extras-clamav
yum install halon-extras-clamav
These functions needs to be imported from the extras://clamav module path.
Scan a File pointer (fp) with ClamAV. If attachements are scanned separately, change the rfc822 options to false.
Params
- fp
File- the mail file - options
array- options array
The following options are available in the options array.
- rfc822
boolean- Scan the content as a "rfc822" message (do not rely on auto-detection). The default is true. - timeout
number- Timeout in seconds. The default is 5 seconds. - path
string- Path to a the clamd unix socket. The default is/var/run/clamav/clamd.ctl - address
string- Host of the clamd server. - port
number- Port of the clamd server.
Returns
An associative array, with a virus property containing a list of viruses found (array of strings), however note that clamd may currently only return one virus. If an error occures an error property (string) is set contaning the error message.
Example
import { clamav } from "extras://clamav";
$clamav = clamav($mail->toFile());
if ($clamav["virus"])
Reject("Virus found");