Skip to main content


ClamAV is an open-source antivirus engine for detecting trojans, viruses, malware & other malicious threats. This plugin provide a bridge between the clamd daemon and your vSMTP service.


In this example, we will setup the ClamAV plugin to be used in the Working service. First, create a the bridge in an isolated rhai module.

// /etc/vsmtp/working/services/antivirus.rhai
import "plugins/libclamav_plugin" as clamav;

export const bridge = clamav::connect(#{
// The socket where clamd listens for connections.
address: "",

Then scan any email from your rules.

// /etc/vsmtp/working/script.rhai
import "services/antivirus.rhai" as antivirus;

fn on_post_queue(ctx) {[
// Rule that stores the email in a `virus` quarantine folder
// if the email is compromised.
rule "run antivirus" |ctx| {
if antivirus::bridge.scan(ctx) {
} else {