Inbox Processing with KumoMTA

  • December 24, 2024
 

KumoMTA is a powerful Message Transfer Agent primarily designed for high-volume outbound delivery, but in mid-December, we added the ability to write messages to local maildir format mailboxes in order to allow for inbound message processing.
This type of handling can include anti-virus scanning, store and forward functions, legal intercept storage, postmaster mailboxes, and many other uses.

To help demonstrate the deployment and potential use, I created a guide to installing KumoMTA + Dovecot + Roundcube for Webmail inboxes. This tutorial explains how to create and access inboxes with webmail on a KumoMTA server. For the sake of this tutorial, we install Roundcube as a webmail front end with Dovecot IMAP server, but it is also possible to process inbox messages directly on the server without any of that.  For instance, if the purpose is for BCC archive storage, no additional processing is needed at all.

Screenshot 2024-12-18 at 10.12.52 AM

Frankly, most of the guide is about configuring Roundcube and Dovecot, which are actually pretty complex.  The KumoMTA component is extremely simple. We leverage the same custom protocol queuing that we have used for routing messages to AMQP, Kafka, and HTTP APIs, but route to a maildir function instead.  This way you only have to identify the top of the maildir location and file permissions inside a queue_config, and KumoMTA does the rest. The sample below will automatically create mailboxes for any mail sent to maildir.example.com.  This could be altered to perform a lookup to a list of approved domains, or even make it conditional on some other factors.  The power of Lua and config-as-code makes the possibilities almost endless.



kumo.on('get_queue_config', function(domain, tenant, campaign, routing_domain)
  if domain == 'maildir.example.com' then
    return kumo.make_queue_config {
      protocol = {
        maildir_path = '/maildirs//',
        dir_mode = tonumber('775', 8),
        file_mode = tonumber('664', 8),
      },
    }
  end
end)

 

After reception, the messages can be AV/AS scanned, or processed in any other way.  If a webmail component is deployed, users can interact directly with them.

KumoMTA brings the power of its high-performance outbound engine to an inbound environment, allowing operators to process millions of messages per hour in a highly flexible way.  Mailbox Providers (MBPs) can access the mailboxes directly with 3rd party tools and also use Lua to programmatically pre-process messages before the even hit the inbox.

Let us know if this helped you. We would love to tell your story.

------------------------------------------------------------------

KumoMTA is the first open-source MTA designed from the ground up for the world's largest commercial senders. We are fueled by Professional Services and Sponsorship revenue.

Join the Discord | Review the Docs | Read the Blog | Grab the Code | Support the team