Skip to main content


Redis is an in-memory storage, used as a distributed, in-memory key–value database, cache and message broker. This plugin provide a bridge for Redis databases.


In this example, we will setup the plugin to be used in the SMTP SMTP Receiver service. First, create a connection pool to the Redis database.

// /etc/vsmtp/smtp-receiver/services/db.rhai
// Import the plugin stored in the `plugins` directory.
import "plugins/libplugin_redis" as redis;

export const bridge = redis::connect(#{
// Connect to a database on the system.
url: "redis://localhost:6379",
timeout: "1m",
// Number of connections to open in the pool.
connections: 4,
import "services/db" as db;

fn on_connect(ctx) {[
action "set a value in my redis server" || {
const okay = db::bridge.set("my_key", "");
log("info", `status is: ${okay}`);