Scroll to navigation

masqmail(8) Maintenance Commands masqmail(8)


masqmail - An offline Mail Transfer Agent


masqmail [-t] [-oi] [-f ADDRESSRECIPIENT...

masqmail -bp

masqmail -q

masqmail -qo NAME

mailrm MSGID...
masqmail -Mrm MSGID...

masqmail [-C FILE] [-odq-bs

masqmail [-C FILE] [-odq-bd -qINTERVAL

(This list is a selection.)


Masqmail is a mail server designed for hosts that do not have a permanent internet connection e.g. a home network or a single host at home. It has special support for connections to different ISPs. It replaces sendmail or other MTAs such as qmail or exim.


Masqmail operates in one of several exclusive modes.

The daemon mode has two flavors that may be, and usually are, used in combination:

-bd or invoked as smtpd

Run as daemon. Act as SMTP server and accept SMTP connections, on port 25 if not configured differently.

This is normally used in the startup script at system boot and together with -qINTERVAL (see below).

Alternatively masqmail can be run with the -bs option from inetd.


Run as daemon. Do regular queue runs at the specified time interval. This is normally used together with -bd (see above).

An argument may be a time interval i.e. a numerical value followed by one of the letters s,m,h,d,w which are interpreted as seconds, minutes, hours, days or weeks respectively. Example: -q30m. Combinations like -q1h30m, which sendmail accepts, are not possible.

Alternatively single queue runs (-q) can be started from cron.

The queue processing mode has two flavors that may be used in combination:

-q (without argument) or invoked as runq

Do a single queue run. Try to deliver all messages in the queue. Masqmail sends to addresses on the local host and to remote ones, if available online routes permit it. That means, masqmail sends all queued mail it can. Online detection is done with the configured method (see online_query in masqmail.conf(5)).

-qo NAME

Do a single queue run and deliver only using the specified online route.

The route configuration for NAME is read and queued mail to matching remote recipients is sent. (See query_routes.NAME in the main config file.)

You may want to use this option in scripts that run as soon as a link to the internet has been set up (e.g. ip-up).

Obsolete behavior: Up to now: If -qo has no argument, the online connection is determinded by online detect and, if available, mail is sent through it. If none is available no mail is delivered.

This behavior is likely to change in future versions because it is included in -q. We could do something more useful instead.

The other modes are simple ones:

-bi or invoked as newaliases

A no-op for masqmail, just exit. Old sendmail rebuilds its alias database when invoked with this option. Masqmail reads directly from its alias file (see config option `alias_file'), thus no database needs to be updated.

-bm, also the default mode

Accept a text message on stdin. This is the default mode of operation. One will hardly use this switch as it is the default.

The command line options -f,-F,-i/-oi,-t are only used in this mode.

-bp or invoked as mailq

Show the messages in the queue.


Act as SMTP server by reading commands from stdin and writing to stdout. Some mailers (e.g. pine) use this option as an interface. It can also be used to call masqmail from inetd.

-bV or if called without arguments

Print version information, then exit.

-Mrm or invoked as mailrm

Remove given messages from the queue. Privileged users may remove any message, other users only their own. The message identifiers are listed when printing the queue (see -bp).

The default mode:

When no mode had been specified by either one of the above command line options or by calling masqmail under a special name, then the default mode -bm (i.e. accept messages on stdin) is entered. However, if neither address arguments are specified nor -t is given, then mail can not be sent, hence something more useful is done: -bV is assumed.


Since masqmail is intended to replace sendmail, it uses the same command line options, but not all are implemented. The -qo option is additional, and unique to masqmail.


Not a `real' option, it means that all following arguments are to be understood as arguments and not as options even if they begin with a leading dash `-'. Mutt is known to call sendmail with this option.

``Daemon (listen)'' mode. See above.

``Rebuild alias database'' mode. See above.

``Accept message'' mode. See above.

``Print queue'' mode. See above.

``Stand-alone SMTP server'' mode. See above.

``Print version'' mode. See above.

arg is usually 8BITMIME. Some mailers use this to indicate that the message contains characters > 127. Masqmail is 8-bit clean and ignores this, so you do not have to recompile elm, which is very painful ;-). Note though that this violates some conventions: masqmail does not convert 8 bit messages to any MIME format if it encounters a mail server which does not advertise its 8BITMIME capability, masqmail does not advertise this itself. This is the same practice as that of exim (but different to sendmail).

Use another configuration than /etc/masqmail/masqmail.conf. Useful for debugging purposes. If not invoked by a privileged user, masqmail will drop all privileges.

Set the debug level. This takes precedence before the value of `debug_level' in the configuration file. Read the warning in the description of the latter. Only root may set the debug level.

Set the return path address to address. Only root, the user mail and anyone in group mail is allowed to do that.

Set the full sender name (in the From: header) to string.

Same as -oi, see below. Kept for compatibility.

``Queue manipulation'' mode. See above.

``Me too'' This switch is ignored as, masqmail never excludes the sender from any alias expansions.

-m is an ancient alias for -om. Kept for compatibility.

``Deliver in Background'' Masqmail always does this. Hence masqmail ignores this switch.

``Do Queueing'' Do not attempt to deliver immediately. Any messages will be queued until the next queue running process picks them up and delivers them. You get the same (but global) effect by setting the do_queue option in /etc/masqmail/masqmail.conf.

A dot as a single character in a line does not terminate the message.

The same as -i.

Any other switch starting with `-o' is ignored. This especially affects -om, -oem, -oee.

``Single queue run (normal)'' mode. See above.


``Daemon (queue)'' mode. See above.

``Single queue run (only named route)'' mode. See above.

Read recipients from mail headers and add them to the ones specified on the command line. (Only To:, Cc:, and Bcc: headers are regarded.)

WARNING: The behavior changed with version 0.3.1!

In earlier versions command line argument addresses were ``substracted'' from header addresses.

The old behavior was similar to exim's and smail's (which are anchesters of masqmail). The new behavior is similar to the one of current postfix versions, which add the arguments to the set of header recipients. (Earlier postfix failed in case of address arguments with -t.) Sendmail seems to behave differently, depending on the version. See exim(8) for further information.

For masqmail the most simple approach had been taken.

As the behavior of -t together with command line address arguments differs among MTAs, one better not steps into this corner case.

``Verbose'' Log also to stdout. Currently, some log messages are marked as `write to stdout' and additionally, all messages with priority `LOG_ALERT' and `LOG_WARNING' will be written to stdout if this option is given. It is disabled in daemon mode.


For security reasons, before any pipe command from an alias expansion or an mda is called, the environment variables will be completely discarded and newly set up. These are:

SENDER, RETURN_PATH – the return path.

SENDER_DOMAIN – the domain part of the return path.

SENDER_LOCAL – the local part of the return path.

RECEIVED_HOST – the host the message was received from (unless local).

LOCAL_PART, USER, LOGNAME – the local part of the (original) recipient.

MESSAGE_ID – the unique message id. This is not necessarily identical with the Message ID as given in the Message ID: header.

QUALIFY_DOMAIN – the domain which will be appended to unqualified addresses.


The main configuration for masqmail. Depending on the settings in this file, you will also have other configuration files in /etc/masqmail/.

The spool directory where masqmail stores its queued mails.

The directory where locally delivered mail will be put, if not configured differently in masqmail.conf.

The directory where masqmail stores its log messages.

Any of the paths can be configured at compile time, and (except the main config file) also in the main config file. The typical paths are different, depending on the Unix system you use.


RFC 821, 822, 1869, 1870, 2197, 2554 (SMTP)

RFC 1321 (MD5)

RFC 2195 (CRAM-MD5)


Masqmail was written by Oliver Kurth. It is now maintained by Markus Schnalke <>.

You will find the newest version of masqmail on its website: There is also a mailing list; you will find information about it on the website.


Bug reports of any kind are very welcome. They help masqmail to become better. Please report bugs to the mailing list (anyone can post).


masqmail.conf(5), masqmail.route(5), masqmail.aliases(5)

2012-01-18 masqmail-0.3.4