Skip to content
Module 2 · Lesson 5 of 25

Just-enough Lua for KumoMTA

Part of KumoMTA: High-Volume Sending Engine, in the Installation, Lua Primer & systemd module.

Author

KumoMTA's config is Lua. You don't need to be a Lua dev. Reading it and copying patterns is enough.

The five constructs you'll see everywhere:

1. Module + function:

local kumo = require 'kumo'

kumo.on('init', function()
  kumo.start_esmtp_listener { listen = '0.0.0.0:25' }
end)

2. Tables (KumoMTA's "config blocks"):

kumo.on('init', function()
  kumo.define_spool { name='data', path='/var/spool/kumomta/data', kind='RocksDB' }
  kumo.define_spool { name='meta', path='/var/spool/kumomta/meta', kind='RocksDB' }
end)

3. Event hooks:

kumo.on('smtp_server_message_received', function(msg)
  -- inspect/modify the message
  msg:set_meta('tenant', 'acme-marketing')
end)

4. Pattern-based throttles:

kumo.on('get_queue_config', function(domain, tenant, campaign)
  return kumo.make_queue_config {
    max_connection_rate = '10/s',
    max_message_rate = '500/s',
  }
end)

5. Pattern matching for destination tuning:

if domain == 'gmail.com' then ...
elseif domain:match('%.protection%.outlook%.com$') then ...
end

That's 90% of what you'll write. The docs at docs.kumomta.com mirror these patterns relentlessly.

Sign in to keep track of what you have read.

Pulse · email sending

Sending infrastructure that is yours alone.

Every domain gets its own MX host, IP, DKIM selector and certificate. Take it managed, and we run it for you, or buy a licence and run it on your own servers.

# on a fresh Ubuntu server
$ cd pulse && sudo ./install.sh
→ docker compose up · kumomta · stalwart · caddy
→ dashboard ready on https://pulse.yourdomain.com
$

Also from us:Beat: monitoring that tells you the fixConsulting: $65/hr, no retainer