---
name: "mailwrapper"
section: "8"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd", "openbsd"]
url: "https://new.carta.tech/mailwrapper"
---

# mailwrapper(8)

invoke appropriate MTA software based on configuration file

## NAME

**mailwrapper** – invoke appropriate MTA software based on configuration file

## SYNOPSIS

Special. See below.

## DESCRIPTION

Once upon time, the only Mail Transfer Agent (MTA) software easily available was “sendmail”. This famous MTA was written by Eric Allman and first appeared in 4.1BSD. The legacy of this MTA affected most Mail User Agents (MUAs) such as [mail(1)](/mail/1.md); the path and calling conventions expected by “sendmail” were compiled in.

But times changed. On a modern FreeBSD system, the administrator may wish to use one of several available MTAs.

It would be difficult to modify all MUA software typically available on a system, so most of the authors of alternative MTAs have written their front end message submission programs that may appear in the place of */usr/sbin/sendmail*, but still follow the same calling conventions as “sendmail”.

The “sendmail” MTA also typically has aliases named [mailq(1)](/mailq/1.md) and [newaliases(1)](/newaliases/1.md) linked to it. The program knows to behave differently when its *argv\[0\]* is “mailq” or “newaliases” and behaves appropriately. Typically, replacement MTAs provide similar functionality, either through a program that also switches behavior based on calling name, or through a set of programs that provide similar functionality.

Although having replacement programs that plug replace “sendmail” helps in installing alternative MTAs, it essentially makes the configuration of the system depend on hand installing new programs in */usr*. This leads to configuration problems for many administrators, since they may wish to install a new MTA without altering the system provided */usr*. (This may be, for example, to avoid having upgrade problems when a new version of the system is installed over the old.) They may also have a shared */usr* among several machines, and may wish to avoid placing implicit configuration information in a read-only */usr*.

The **mailwrapper** program is designed to replace */usr/sbin/sendmail* and to invoke an appropriate MTA based on configuration information placed in *${LOCALBASE}/etc/mail/mailer.conf* falling back on */etc/mail/mailer.conf*. This permits the administrator to configure which MTA is to be invoked on the system at run time.

Other configuration files may need to be altered when replacing [sendmail(8)](/sendmail/8.md). For example, if the replacement MTA does not support the **-A** option with [mailq(1)](/mailq/1.md), *daily\_status\_include\_submit\_mailq* should be turned off in */etc/periodic.conf*.

## FILES

Configuration for **mailwrapper** is kept in *${LOCALBASE}/etc/mail/mailer.conf* or */etc/mail/mailer.conf*. */usr/sbin/sendmail* is typically set up as a symbolic link to **mailwrapper** which is not usually invoked on its own.

## EXIT STATUS

The **mailwrapper** utility exits 0 on success, and \>0 if an error occurs.

## DIAGNOSTICS

The **mailwrapper** will print a diagnostic if its configuration file is missing or malformed, or does not contain a mapping for the name under which it was invoked.

## SEE ALSO

[mail(1)](/mail/1.md), [mailq(1)](/mailq/1.md), [newaliases(1)](/newaliases/1.md), [mailer.conf(5)](/mailer.conf/5.md), [periodic.conf(5)](/periodic.conf/5.md), [dma(8)](/dma/8.md), [sendmail(8)](/sendmail/8.md)

## HISTORY

The **mailwrapper** utility first appeared in NetBSD 1.4 and then FreeBSD 4.0.

## AUTHORS

Perry E. Metzger ⟨*perry@piermont.com*⟩

## BUGS

The entire reason this program exists is a crock. Instead, a command for how to submit mail should be standardized, and all the “behave differently if invoked with a different name” behavior of things like [mailq(1)](/mailq/1.md) should go away.
