MH-ALIAS(5)
π MH-ALIAS π
okay so bestie, gather round, because we're about to talk about mh-alias β that's the format of nmh email-address alias files, and honestly? it's giving β¨ancient scroll of powerβ¨. no cap, this is the file that tells nmh who's who before your mail goes anywhere.
πΈ DESCRIPTION πΈ
every single line of an nmh alias file is one of these shapes, periodt:
alias : address-group
alias ; address-group
< alias-file
; | : | # comment
and where those pieces come from:
address-group := address-list
| < file
address-list := address
| address-list, address
continuation lines? they end with \ and then a newline character. yes queen, keep going on the next line. and that goes for comment lines too, which means the line right after a \-terminated comment line is a continuation of that same comment line. so like, comments can vibe across multiple lines. π
Alias-file and file are Unix file names. alias file contents are case-insensitive, with one exception: filesystem path names stay case-sensitive, obviously, they have a job.
if a line starts with <, the file named right after that < gets read for more alias definitions. and it's recursive, so a < can show up at the beginning of an alias file and everything just works the way you'd expect. π¦
if the address-group starts with a <, the file named after it gets read and its contents get added to the address-list for that alias. two different < behaviours, both iconic, don't mix them up.
in matching, a trailing * on an alias will match just about anything appropriate. wildcard main character energy.
here's an approximation of how aliases get resolved at posting time β the whole pipeline, no skips:
- build a list of all addresses from the message to be delivered, eliminating duplicate addresses.
- for those addresses in the message that have no host specified, perform alias resolution.
- for each line in the alias file, compare
aliasagainst all of the existing addresses. if there's a match, remove the matchedaliasfrom the address list, and add each new address in the address-group to the address list if it's not already on the list. the alias itself is not usually output β instead, the address-group that the alias maps to is what gets output. but ifaliasis terminated with a;instead of a:, then both thealiasand the address are output in the correct format (with the alias quoted if necessary and the address wrapped in<>). π
and because the mh-alias file is read line by line, forward references work, but backward references are not recognized. read top to bottom, bestie, no looking back. π
π Example Alias File
</etc/nmh/BBoardAliases
sgroup: fred, fear, freida
fred: frated@UCI.example
b-people: Blind List: bill, betty
Unix-committee: <unix.aliases
news.*: news
okay let's break this down because it's honestly so cute:
- the first line says more aliases should immediately be read from the file
/etc/nmh/BBoardAliases. - next,
sgroupis defined as an alias for three names, and one of them,fred, is a forward reference to another alias forfrated@UCI.example. forward refs slay, remember? - the alias
b-peopleis a blind list which includes the addressesbillandbetty; the message will be delivered to those addresses, but the message header will show onlyBlind List: ;(not the addresses). the alias must not be terminated with, or contain, a semicolon. and heads up β blind lists are not supported with thesendmail/pipemail transport method. that one's a real limitation, don't come for me. - the definition of
Unix-committeeis given by reading the fileunix.aliasesin the user'snmhdirectory. - lastly,
news.anythingis aliased tonews; the full stop is just another literal character. not a regex, not a wildcard, just a dot doing its little dot thing. β
π PROFILE COMPONENTS π
Aliasfile:β default alias file. that's the whole list, she's low maintenance.
π FILES π
/etc/nmh/MailAliasesβ system-wide default alias file.
π SEE ALSO π
ali(1), send(1), whom(1), getgrent(3), getpwent(3), post(8)
go read those too, they're the friend group. π«Ά
π BUGS π
- so, the forward-referencing semantics of
mh-aliasfiles prevent recursion... but the alias-file directive may defeat this. and since the number of file descriptors is finite, that kind of infinite recursion will terminate with a meaningless diagnostic when all the fds are used up. not a graceful exit, bestie, just chaos. π - earlier versions of this man page showed a semicolon at the end of the blind list example. that caused the preceding alias to not be expanded. there must not be a semicolon at the end of, or within, the address group of a blind list.
postwill append the semicolon to the blind list name.
fr fr, that's the whole page. no details left behind, every flag, file, and footgun accounted for. π
mwah π this was nmh-1.8, dated 2014-04-18, and that's the MH-ALIAS(5) page β thanks for coming to my ted talk, ily, go alias responsibly πβ¨
π¦ where this page comes from
- alpine 3.24: nmh-doc 1.8-r3 Β· BSD-3-Clause
- epel 10: nmh 1.8-3.el10_1 Β· BSD
- epel 9: nmh 1.8-1.el9 Β· BSD
- fedora 43: nmh 1.8-9.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: nmh 1.8-10.fc44 Β· LicenseRef-Callaway-BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms