Table of Contents

1 Introduction

Mockmta is a simplistic implementation of the SMTP mail transport agent, designed for testing purposes. It behaves almost identically to any real MTA, except that it listens on localhost only and delivers all messages to the given UNIX mailbox file.

No attempts are made to interpret the data supplied during the STMP transaction, such as domain names, email addresses, etc, neither is the material supplied in the DATA command verified to be a valid email message. Except for being written to mailbox, these data are ignored.

The program is derived from the eponymous tool I wrote for the GNU mailutils testsuite.

2 Compilation

The usual sequence applies:

make install

If you want mockmta to support STARTTLS command, make sure the GnuTLS library version 3.3.0 or newer is installed on your system and is reported correctly by pkg-config.

3 Usage

Mockmta can work both as an inetd-style process (default) and as a standalone daemon.

In inetd mode it reads SMTP commands from stdin and issues responses on stdout. Logging messages go to stderr.

To run mockmta as a daemon, give it the -d option. In this mode it listens on localhost port 25 by default. The port number can be changed using the -p command line option.

In daemon mode, logging goes to the syslog facility mail.

In both modes, logging verbosity can be controlled using the -l (ell) option. By default, mockmta outputs error and warning messages, as well as the status of each SMTP transaction. This corresponds to the option -l info. To request detailed transcript of each SMTP session, use -l debug. To output only notices and more important messages, use -l notice.

Support for STARTTLS command is enabled using the following three options:

  • -c CERT

Sets the name of certificate file.

  • -a CA

Sets the name of certificate authority file.

  • -k KEY

Sets the name of certificate key file.

Two informative options are provided: -? prints a short usage summary, and -v prints the program version and TLS support status.

See documentation for a detailed discussion.

4 Documentation

Manual page is included in distribution. After successful installation, run man mockmta and read the docs.

The online copy of the documentation is available.


Mockmta is available for download from

Each tarball is signed using the author's GPG key. To verify it, import the author's key using the following command:

gpg --keyserver --recv-keys 3602B07F55D0C732

Then, download the signature file and run

gpg --verify mockmta-1.0.tar.gz

6 Development and bug reports

To track development of mockmta, visit the project home.

Use the bug tracker on that page to report bugs or problems, or mail them to Sergey Poznyakoff.

7 License

Copyright (C) 2020-2021 Sergey Poznyakoff

Mockmta is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Mockmta is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GNU Mailutils. If not, see

Author: Sergey Poznyakoff

Created: 2021-06-16 Wed 18:27

Emacs 25.3.1 (Org mode 8.2.10)