Basic configuration

vSMTP Configuration

Let’s build a vSMTP configuration step by step.

When installing vSMTP, the package manager creates the following basic configuration.

+┣ vsmtp.vsl
+β”— conf.d/
+      β”— config.vsl

vSMTP default configuration

Configure vSMTP

Modify the /etc/vsmtp/conf.d/config.vsl file with this configuration:

fn on_config(config) {
  // Name of the server. = "";

  // addresses that the server will listen to.
  // (change `` for the desired address)
  config.server.interfaces = #{
    addr: [""],
    addr_submission: [""],
    addr_submissions: [""],


Configuring vSMTP

For complex configurations, it is recommended to split the file into Rhai modules.

To get an exhaustive list of parameters that can be changed in the configuration, see the Configuration Reference chapter.

The server can now listen and serve SMTP connections.

Filtering objects

Let’s define all the required objects for John Doe’s MTA. Those objects are used to configure vSMTP and simplify filtering rules.

Create the /etc/vsmtp/objects/family.vsl file with following objects:

// Doe's family domain name.
export const domain = fqdn("");

// Mailboxes.
export const john = address("");
export const jane = address("");
export const jimmy = address("");
export const jenny = address("");

export const addresses = [john, jane, jimmy, jenny];

// Paths for quarantines.
export const virus_queue = "virus";
export const untrusted_queue = "untrusted";

// A user blacklist file
export const blacklist = file("domain-available/", "fqdn");

Objects that will be used during filtering

See the Object chapter for more information.


Define a blacklist file at /etc/vsmtp/domain-available/ with the following contents:

Blacklist content

Listen and serve

The file structure of /etc/vsmtp should now look like this.

 ┣ vsmtp.vsl
 ┣ conf.d/
 ┃      β”— config.vsl
 ┣ domain-available/
+┃      β”—
+┃          β”— blacklist.txt
+β”— objects/
+       β”— family.vsl

Adding objects and the blacklist to the configuration directory

If no interface is specified, the server listens on localhost on port 25, 465 and 587. Remote connections are therefore refused.

$> sudo systemd restart vsmtp
$> telnet
# 220 Service ready
# 554 permanent problems with the remote server

Test by opening a connexion to the server