MH-PROFILE(5mh)
✨ NAME ✨
mh-profile, mh_profile — user customization for nmh message handler
okay so this is the MH-PROFILE(5mh) manual, bestie 💖 and it's literally the glow-up guide for your nmh message handler. no cap.
🦋 DESCRIPTION 🦋
Each user of nmh is expected to have a file named .mh-profile in their home directory. This file contains a set of user parameters used by the nmh family of programs. Each entry in the file is of the format
profile-component: value
If the text of a profile entry is long, you may extend it across several real lines by indenting the continuation lines with leading spaces or tabs. Comments may be introduced by a line starting with #::
#: This is a comment.
Blank lines are not permitted in .mh-profile. Shell quoting conventions are not available; each token is separated by whitespace. periodt.
💖 Standard Profile Entries 💖
The possible profile components are exemplified below. The only mandatory entry is Path:. The others are optional; some have default values if they are not present. In the notation used below, (profile, default) indicates whether the information is kept in the user's nmh profile or nmh context, and indicates what the default value is. Note that a profile component can only appear once. Multiple appearances will trigger a warning that all appearances after the first are ignored. so don't try to double-dip, bestie 💅
Some MH programs, including mhbuild, mhshow, and mhstore, have specific profile components that are described in their respective man pages. Each component name specific to these programs begins with the name of the program and is followed by a dash.
Path: Mail— Locates nmh transactions in directory “Mail”. A relativePathstarts from the user's home directory. This is the only mandatory profile entry.(profile, no default)like the main character it is 👑locale: locale— Set the locale for all nmh programs exceptpost,install-mh, andslocal. See theLC_ALL,LC_CTYPE, andLANGvariables in the "ENVIRONMENT" section below for a reference on how the locale is set if this profile component is not used.context: context— Declares the location of the nmh context file. This can be overridden by the environment variableMHCONTEXT. See theHISTORYsection below.(profile, default: <nmh-dir>/context)Current-Folder: inbox— Keeps track of the current open folder.(context, default: folder specified by “Inbox”)Inbox: inbox— Defines the name of the default inbox.(profile, default: inbox)Previous-Sequence: pseq— Names the sequence or sequences which should be defined as themsgsormsgargument given to any nmh command. If not present or empty, no such sequences are defined. Otherwise, for each name given, the sequence is first zeroed and then each message is added to the sequence. Readmh-sequence(5)for the details about this sequence.(profile, no default)Sequence-Negation: not— Defines the string which, when prefixed to a sequence name, negates that sequence. Hence, “notseen” means all those messages that are not a member of the sequence “seen”. Readmh-sequence(5)for the details.(profile, no default)Unseen-Sequence: unseen— Names the sequence or sequences which should be defined as those messages which are unread. The commandsinc,rcvstore,mhshow, andshowwill add or remove messages from these sequences when they are incorporated or read. If not present or empty, no such sequences are defined. Otherwise, each message is added to, or removed from, each sequence name given. Readmh-sequence(5)for the details about this sequence.(profile, no default)mh-sequences: .mh-sequences— The name of the file in each folder which defines public sequences. To disable the use of public sequences, leave the value portion of this entry blank.(profile, default: .mh-sequences)atr-seq-folder: 172 178-181 212— Keeps track of the private sequence called “seq” in the specified folder. Private sequences are generally used for read-only folders. Seemh-sequence(5)for details about private sequences.(context, no default)Editor: prompter— Defines the editor to be used by the commandscomp,dist,forw, andrepl. If not set, the value will be taken from theVISUALandEDITORenvironment variables.(profile, default: prompter)Msg-Protect: 600— An octal number which defines the permission bits for new message files. Seechmod(1)for an explanation of the octal number. Note that some filesystems, such as FAT32, do not support removal of read file permissions.(profile, default: 0600)Folder-Protect: 700— An octal number which defines the permission bits for new folder directories. Seechmod(1)for an explanation of the octal number.(profile, default: 700)datalocking: fcntl— The locking algorithm used to lock changes to any nmh data files, such as sequences or context. The locking algorithm is any one of the following entries:
fcntl dot flock lockf
Available locking algorithms can vary depending on the operating system. Note: currently, transactional locking is only supported on public sequences; see mh-sequence(5) for more information. (profile, default: fcntl)
program: default switches— Sets default switches to be used whenever the mh program program is invoked. For example, one could override the “Editor:” profile component when replying to messages by adding a component such as:
repl: -editor /bin/ed
(profile, no defaults)
lasteditor-next: nexteditor— Names “nexteditor” to be the default editor after using “lasteditor”. This takes effect at the “What now?” prompt incomp,dist,forw, andrepl. After editing the draft with “lasteditor”, the default editor is set to be “nexteditor”. If the user types “edit” without any arguments to “What now?”, then “nexteditor” is used.(profile, no default)Folder-Stack: folders— The contents of the folder-stack for thefoldercommand.(context, no default)Local-Mailbox: Your Username <user@some.host>— Tells the MH programs what your local mailbox is. If set, it will be used by the default component files by programs likecompandreplto construct your default “From:” header. The text used here will be copied exactly to your “From:” header, so it should already be RFC 822 compliant. If this is set, theSignatureprofile entry is not used, so it should include a signature as well.(profile, default: userid@local.hostname)Alternate-Mailboxes: mh@uci-750a, bug-mh*— Tellsreplandscanwhich additional addresses are yours. In this way,replknows which addresses should be included in the reply, andscanknows if a message originated from you. Addresses must be separated by a comma, and the hostnames listed should be the “official” hostnames for the mailboxes you indicate, as local nicknames for hosts are not replaced with their official site names. For each address, if a host is not given, then that address on any host is considered to be you. In addition, an asterisk (`*') may appear at either or both ends of the mailbox and host to indicate wild-card matching.(profile, default: your user-id)Aliasfile: aliases other-aliases— Indicates alias files forali,whom, andsend. This may be used instead of the-alias fileswitch.(profile, no default)Draft-Folder: drafts— Indicates a default draft folder forcomp,dist,forw,refile, andrepl. Readmh-draft(5)for details.(profile, no default)digest-issue-list: 1— Tellsforwthe last issue of the last volume sent for the digest list.(context, no default)digest-volume-list: 1— Tellsforwthe last volume sent for the digest list.(context, no default)MailDrop: .mail— Tellsincyour mail drop, if different from the default. This is superseded by the environment variableMAILDROP.(profile, default: /var/mail/$USER)Signature: RAND MH System (agent: Marshall Rose)— Tells front-end programs such ascomp,forw, andreplyour mail signature. (This is not to be confused with a.signaturethat might be appended to mails.) This is superseded by the environment variableSIGNATURE. IfSIGNATUREis not set and this profile entry is not present, the “gcos” field of the/etc/passwdfile will be used. Your signature will be added to the addresssendputs in the “From:” header; do not include an address in the signature text. The “Local-Mailbox” profile component supersedes all of this.(profile, no default)credentials: legacy— Indicates how the username and password credentials will be retrieved for access to external servers, such as those that provide SMTP or POP service. The supported entry values are “legacy”, “file:netrc”, and “file-nopermcheck:netrc”. With “legacy”, or if there is no credentials entry, the username is the first of:-userswitch toinc,msgchk,post,send, orwhomprogram- the login name on the local machine
The password for SMTP services is the first of:
- password value from matching entry in file named
.netrcin the user's home directory - password obtained by interactively prompting the user
With a “file:netrc” credentials entry, the username is the first of:
-userswitch to program- login name from matching entry in netrc file
- value provided by user in response to interactive query
Similarly, the password is provided either in the netrc file or interactively. netrc can be any valid filename, either absolute or relative to Path or $HOME. The netrc file contains authentication information, for each server, using a line of the following form. (Replace myserver, mylogin, and mypassword with your own account information.)
machine myserver login mylogin password mypassword
This netrc file must be owned and readable only by you.
The “file-nopermcheck:netrc” credentials entry is identical in behavior to the “file” entry, with the exception that the permission checks done by “file” are not performed. This entry should be used with caution and only when absolutely necessary. (profile, default: legacy)
Welcome: disable— if theWelcomecomponent isn't there at all, or its value isn't literallydisable, then bestie… you're getting a welcome message. It pops up the first time you run any interactive nmh program after updating your nmh installation, and you must press the Enter key to keep going. No skipping, no escape, just vibes and the Enter key. 🫶
But wait, there's a little loophole, and it's giving ✨conditional✨: if the MHCONTEXT environment variable is set and non-empty (and Welcome still isn't disable), the welcome message only shows up if the context file has a version reference in it and that reference is older than the nmh version you've got installed. That version reference looks exactly like this:
Version: nmh-1.8
🌸 Process Profile Entries 🌸
Okay so this next little family of profile elements? They all get used whenever an nmh program needs to invoke some other program — like more, for example. And the whole point of .mh-profile is that you get to swap in alternate programs if that's your vibe. 💅 The default values are literally the ones shown in the examples below, so you know exactly what you're getting.
Here's the tea on how they get run, and this part matters: if the profile element contains spaces, it gets split at spaces into tokens, and each token is handed to theexecvp(2)system call as a separate argument. But if the element contains shell metacharacters? Then the entire element gets executed using/bin/sh. Different energy, different execution path. 👑
buildmimeproc:/usr/bin/mh/mhbuild— this is the programwhatnowuses to process drafts that are MIME composition files. MIME girlies, this one's for you. 🎀fileproc:/usr/bin/mh/refile— this program refiles or links a message into another folder. Where's it used? Okay, sit down:postuses it to file a copy of a message into a folder given by a“Fcc:”field. The draft folder facility incomp,dist,forw, andrepluses it to refile a draft message into another folder. And it's also used to refile a draft message when you hit therefiledirective at the“What now?”prompt. She's booked and busy. 🔥formatproc— (no default value given) this is the programmhlcalls to filter a component when it's tagged with the“format”variable in the mhl filter. Want more lore? Go readmhl(5). 📖incproc:/usr/bin/mh/inc— the programmhmailcalls to incorporate new mail when it's invoked with no arguments. New mail, no arguments, say less. ✨lproc:more— this program lists the contents of a message in response to thelistdirective at the“What now?”prompt. It's also used by the draft folder facility incomp,dist,forw, andreplto display the draft message. (And heads up bestie: thePAGERenvironment variable supersedes the default built-in pager command.) 🙈mailproc:/usr/bin/mh/mhmail— the program used to automatically mail various messages and notifications.senduses it to post failure notices. It's also used to retrieve an external-body with access-typemail-server— like when you're storing the body withmhstore. 💌mhlproc:/usr/lib/mh/mhl— the program used to filter messages in various ways.mhshowuses it to filter and display the message headers of MIME messages. When-formator-filteris used byforworrepl,mhlprocfilters the message you're forwarding or replying to. And when-filteris given tosend,mhlprocfilters the copy of the message sent to“Bcc:”recipients. Filtering everywhere, it's a lifestyle. 🦋moreproc:more— the programmhluses to page the mhl-formatted message when displaying to a terminal. It's also the default programmhshowuses to display message bodies (or message parts) of typetext/plain. (Same note as before, bestie: thePAGERenvironment variable supersedes the default built-in pager command.) 💜packproc:/usr/bin/mh/packf— currently not used. Iconic in a retired-way. 💀postproc:/usr/lib/mh/post— the programsend,mhmail,rcvdist, andviamail(which is used by thesendfilesshell script) use to post a message to the mail transport system. It's also called bywhom(invoked with the switches-whomand-library) to do address verification. 📬
⚠️ And here's a warning you need to hear: if the profile contains apostcomponent but there's nopostproccomponent present, then every nmh program that reads the profile and has its stderr associated with a terminal will display a warning message saying that thepostcomponent will be ignored. So don't leave her hanging. 😭
rmmproc:none— the programrmm,refile, andmhfixmsguse to delete a message from a folder. Deleting is serious business, periodt.sendproc:/usr/bin/mh/send— the programwhatnowuses to actually send the message. The moment of truth. 🔥showmimeproc:/usr/bin/mh/mhshow— the programshowuses to process and display non-text (MIME) messages. 🌈showproc:/usr/lib/mh/mhl— the programshowuses to filter and display text (non-MIME) messages. ⭐whatnowproc:/usr/bin/mh/whatnow— the program invoked bycomp,dist,forw, andreplto query about the disposition of a composed draft message. That's literally where the“What now?”prompt comes from, iykyk. 👑whomproc:/usr/bin/mh/whom— the programwhatnowuses to determine to whom a message would be sent. 🎯
🧚 Profile Lookup 🧚
So after consulting .mh_profile, some programs go on to read an optional profile specified by a program-specific environment variable, and then the system-wide profile /etc/nmh/mhn.defaults. Those programs are: mhbuild, mhshow, mhstore, and mhn. And mhfixmsg is similar — but she has no optional profile. Different journey, same destination. 💫
Here's the rule that matters: the first occurrence of a component is the one that gets used. So like, .mh_profile's version trumps $MHSHOW's version. Periodt. And a component with no value still stops any further occurrences from being used — but it's considered absent. Yeah, she blocks the door and then doesn't even come to the party. 😭
Also important: .mh-profile contains only static information, and nmh programs will not update it. Changes in context go to the context file kept in the user's nmh directory instead. That includes — but is not limited to — the “Current-Folder” entry and all private sequence information. Public sequence information? That's kept in each folder, in the file determined by the “mh-sequences” profile entry (default is .mh-sequences). Two different homes, two different vibes. 🏠
And one more cute thing: .mh-profile can override the path of the context file by specifying a “context” entry — and this must be in lower-case, no exceptions. If the entry isn't absolute (meaning it doesn't start with a “/”), then it's interpreted relative to the user's nmh directory. Which means you can actually have more than one set of private sequences just by using different context files. Multiple contexts, multiple sequences, multiple main character eras. 💅✨
🌈 ENVIRONMENT 🌈
Okay so, plot twist: nmh and its commands are also controlled by environment variables, bestie. Many of these are used internally by the “What now?” interface. It's literally amazing how much info has to get passed via environment variables to make the “What now?” interface look squeaky clean to the nmh user, isn't it? The reason for all this is that the nmh user can select any program as the whatnowproc, including one of the standard shells. As a result, it's not possible to pass information via an argument list. The convention is that environment variables whose names are all upper-case are user-settable; those whose names are lower-case only are used internally by nmh and should not generally be set by the user.
HOME— if set and non-null, it's used as the user's home directory. If not set or null, thengetpwuid(3)'spw_diris used.LC_ALL,LC_CTYPE, andLANG— these variables are used to set the locale, seelocale(1). The “locale” profile entry supersedes these.MAILDROP— this variable tellsincthe default mail drop. This supersedes the “MailDrop” profile entry.MAILHOST— this variable tellsincthe POP host to query for mail to incorporate. Seeinc(1)for more information.MH— with this environment variable, you can specify a profile other than.mh-profileto be read by the nmh programs that you invoke. If the value ofMHis not absolute, (i.e., does not begin with a “/”), it will be presumed to start from the current working directory. This is one of the very few exceptions in nmh where non-absolute pathnames are not considered relative to the user's nmh directory.MHBUILD— with this environment variable, you can specify an additional user profile (file) to be read bymhbuild, in addition to themhn.defaultsprofile.MHCONTEXT— with this environment variable, you can specify a context other than the normal context file (as specified in the nmh profile). As usual, unless the value ofMHCONTEXTis absolute, it will be presumed to start from your nmh directory.MHLDEBUG— if this variable is set to a non-null value,mhlwill emit debugging information.MHMTSCONF— if this variable is set to a non-null value, it specifies the name of the mail transport configuration file to use byinc,post, and other programs that interact with the mail transport system, instead of the default. Seemh-tailor(5).MHMTSUSERCONF— if this variable is set to a non-null value, it specifies the name of a mail transport configuration file to be read in addition to the default. Seemh-tailor(5).MHN— with this environment variable, you can specify an additional user profile (file) to be read bymhn, in addition to themhn.defaultsprofile.mhnis deprecated, so support for this variable will be removed from a future nmh release.MHSHOW— with this environment variable, you can specify an additional user profile (file) to be read bymhshow, in addition to themhn.defaultsprofile.MHSTORE— with this environment variable, you can specify an additional user profile (file) to be read bymhstore, in addition to themhn.defaultsprofile.MHTMPDIR,TMPDIR— these variables are searched, in order, for the directory in which to create some temporary files.MHTMPDIRis deprecated and will be removed in a future release of nmh.MHWDEBUG— if this variable is set to a non-null value, nmh commands that use theAlternate-Mailboxesprofile entry will display debugging information about the values in that entry.PAGER— if set to a non-null value, this supersedes the value of the default built-in pager command.SIGNATURE— this variable tellssendandpostyour mail signature. This supersedes the “Signature” profile entry, and is not used when the “Local-Mailbox” profile component is set.USER— this variable tellsreplyour user name andincyour default mail drop: see the “MailDrop” profile entry.USERNAME_EXTENSION— this variable is for use withusername_extensionmasquerading. Seemh-tailor(5).editalt— this is the alternate message. This is set bydistandreplduring edit sessions so you can peruse the message being distributed or replied to. The message is also available, when the-atfileswitch is used, through a link called “@” in the current directory if your current working directory and the folder the message lives in are on the same Unix filesystem, and if your current working directory is writable.mhaltmsg—distandreplsetmhaltmsgto tell thewhatnowprocabout an alternate message associated with the draft (the message being distributed or replied to).mhannotate— this is set bydist,forw, andreplif annotations are to occur.mhdist—distsetsmhdistto tell thewhatnowprocthat message re-distribution is occurring.mhdraft— this is the path to the working draft. It is set bycomp,dist,forw, andreplto tell thewhatnowprocwhich file to ask “What now?” questions about.mheditor— this is set bycomp,repl,forw, anddistto tell thewhatnowprocthe user's choice of editor (unless overridden by-noedit).mhfolder— this is the folder containing the alternate message. It is set bydistandreplduring edit sessions so you can peruse other messages in the current folder besides the one being distributed or replied to. The environment variablemhfolderis also set bynext,prev, andshowfor use bymhl.mhinplace— this is set bydist,forw, andreplif annotations are to occur.mhmessages— this is set bydist,forw, andreplif annotations are to occur.mhuse— this may be set bycomp.
🎀 FILES 🎀
$HOME/.mh-profile— the user's profile.<mh-dir>/context— the user's context<folder>/.mh-sequences— public sequences for<folder>.
👑 SEE ALSO 👑
💀 BUGS 💀
There is some question as to what kind of arguments should be placed in the profile as options. In order to provide a clear answer, recall the command line semantics of all nmh programs: conflicting switches (e.g. -header and -noheader) may occur more than one time on the command line, with the last switch taking effect. Other arguments, such as message sequences, filenames and folders, are always remembered on the invocation line and are not superseded by following arguments of the same type. Hence, it is safe to place only switches (and their arguments) in the profile.
If one finds that an nmh program is being invoked again and again with the same arguments, and those arguments aren't switches, then there are a few possible solutions to this problem. The first is to create a (soft) link in your $HOME/bin directory to the nmh program of your choice. By giving this link a different name, you can create a new entry in your profile and use an alternate set of defaults for the nmh command. Similarly, you could create a small shell script which called the nmh program of your choice with an alternate set of invocation line switches (using links and an alternate profile entry is preferable to this solution).
Finally, the csh user could create an alias for the command of the form:
alias cmd 'cmd arg1 arg2 ...'
In this way, the user can avoid lengthy type-in to the shell, and still give nmh commands safely. (Recall that some nmh commands invoke others, and that in all cases, the profile is read, meaning that aliases are disregarded beyond an initial command invocation)
and that's the vibe check, bestie 💖 this whole page is from nmh-1.8, dated 2016-10-19. periodt. 💅
📦 where this page comes from
- debian trixie: nmh 1.8-3
- ubuntu noble: nmh 1.8-1build4
- ubuntu questing: nmh 1.8-3
- ubuntu resolute: nmh 1.8-4
- ubuntu stonking: nmh 1.8-4build1
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms