OnWorks favicon

mailexec - Online in the Cloud

Run mailexec in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command mailexec that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



mailexec - run program on messages in mbox file or maildir


mailexec [-nvFR] mailbox program [arg ...]


mailexec runs a program over every message in mailbox, which must be an mbox-format mail
file or maildir directory. For each message encountered, mailexec executes program with
the specified arguments, supplying the message as standard input. mailexec synthesizes a
"From " line and a "Return-Path:" header field for each message if the message does not
already contain one. (This behavior can be modified by the -F and -R flags, described

When parsing mbox format files, mailexec unescapes "From " lines. If a line begins with
one or more ">" characters followed by "From ", mailexec deletes one of the ">"
characters. If you do not want this unescaping behavior, see the formail(1) utility,
which has a -s flag that performs a similar function to mailexec.

-n When processing a maildir, causes mailexec to look exclusively at "new" messages that
have not yet been moved to the cur directory.

-v Turns on verbose mode. If mailbox is a maildir, mailexec prints out the name of each
file it processes inside the maildir. If mailbox is an mbox format file, mailexec
prints the message-id of each message it processes (as long as messages have a
message-id header).

-F Suppresses printing of the initial "From " line at the beginning of each message.

-R Suppresses printing of initial "Return-Path:" lines.


To get the same behavior as the Unix from(1) command on a mail directory dir, you can run
either of the following two commands:

mailexec -n dir head -1
mailexec -n dir sed -ne 1p

To convert an mbox-format file mbox into a maildir directory dir, you can run:

mailexec mbox deliver dir/

Conversely, to convert maildir dir into an mbox-format file mbox, run:

mailexec dir deliver mbox

To train the spamassassin filter on a mail folder called spam containing unwanted
messages, run:

mailexec spam sa-learn --spam

Note that this works whether spam is an mbox format file or a maildir directory.

If you have an old mbox file or maildir directory box and wish to "import" the old mail
into your web mail account, say [email protected], you can run:

mailexec -F box sendmail [email protected]

Note again that this works whether box is an mbox format file or a maildir directory.

Use mailexec online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

Linux commands