MTAopts for mailx


This is a patch for the Heirloom mailx email client (aka nail, often installed simply as mail). The patch implements a new configuration variable: mtaopts. Mailx will pass the contents of this variable on to the Mail Transfer Agent’s command-line upon message sending.

mtaopts can also be set within a config file’s account{} blocks, enabling the user to pass different options for different accounts.

This patch was born out of the need to prevent the MTA from exposing the real username and the internal hostname of the machine where mailx is running. Being able to supply alternate addresses by account, makes mailx more suitable and practical for Internet email.

I use mtaopts to pass my MTA the -f option. So the initial From line (usually a hidden header) will contain my Internet email address, not my local username and hostname. Here’s an excerpt from my ~/.mailrc:

account dn {
	set from='Dario Niedermann <>'
	set mtaopts='-f'
“MTAopts for mailx” is Copyright © Dario Niedermann — Released with no warranty under the terms of the GPLv3 license. Written and tested on Linux using GNU tools.
HomeNo Javascript iconValid HTML 4.01 StrictValid CSS!