Skip to main content

Configuration

vSMTP configuration is stored in the /etc/vsmtp/<service> directory. Each service as it's own set of configuration file and is run independently from the others.

Rhai

To provide a simple yet powerful interface to configure vSMTP, every configuration file is written using the Rhai scripting language, which syntax resembles javascript.

Rhai is also used for filtering emails. We will explore this feature in the next chapter.

Configuration file

Here is an example of a possible configuration file for the SMTP Receiver service.

/etc/vsmtp/smtp-receiver/conf.d/config.rhai
fn on_config(config) {
// The receiver will listen on both `127.0.0.1:25` and `127.0.0.1:587` addresses.
config.interfaces = #{
addr: ["127.0.0.1:25"],
addr_submission: ["127.0.0.1:587"],
};

// Options to connect securly with the RabbitMQ broker.
config.broker.uri = "amqps://vsmtp-dev:password@example.com:5671/vsmtp-dev";
config.broker.certificate_chain = "/etc/ssl/certs/ca-certificates.crt";

// Filtering scripts configuration.
config.scripts.path = "/etc/vsmtp/smtp-receiver/rules.rhai";

// Enable pipelining and dns.
config.esmtp = #{
pipelining: true,
dsn: true,
};

// The configuration is done, return it !
return config;
}

As you can see, the configuration is done from a function entrypoint called on_config with a config parameter. To change the config, we simply have to change the values of the config object.

The fields descriptions and defaults will be described in future chapters, and are listed in the [Configuration Reference].