MH-PROFILE(5)

๐Ÿ“ฆ
version 1.8 ยท 4 versions
, in alpine 3.24, epel 10, epel 9, fedora 43, fedora 44

โœจ NAME โœจ

mh-profile, mh_profile โ€” user customization for nmh message handler ๐ŸŽ€

So bestie, this is the man page for mh-profile (also spelled mh_profile, same vibe, different spelling ๐Ÿ’…).


๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay so. every single user of nmh is expected to have a file called .mh-profile chilling in their home directory ๐Ÿ . this file is literally just a lil bundle of user parameters that the whole nmh family of programs reads. every entry in it looks like this:

profile-component: value

if the text of a profile entry is long (and honestly, when is it not ๐Ÿ˜ญ), you can extend it across several real lines by indenting the continuation lines with leading spaces or tabs. and if you wanna leave a lil note to yourself, comments get introduced by a line starting with #::

#: This is a comment.
โš ๏ธ blank lines are not permitted in .mh-profile. not even one. not even a lil baby one. also, shell quoting conventions are not available โ€” each token is separated by whitespace. that's just the rules, no cap.

๐Ÿฆ‹ Standard Profile Entries ๐Ÿฆ‹

the possible profile components are exemplified below ๐Ÿ‘‡ the only mandatory entry is Path: โ€” everything else is optional, and some of them have default values if you don't bother setting them. in the notation used below, (profile, default) tells you whether the information is kept in the user's nmh profile or nmh context, and also tells you 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.

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 relative Path starts from the user's home directory. this is the only mandatory profile entry, so like, you literally cannot skip it. (profile, no default)
  • locale: locale โ€” sets the locale for all nmh programs except post, install-mh, and slocal. ๐ŸŒ if this profile component isn't used, go peek at the LC_ALL, LC_CTYPE, and LANG variables in the "ENVIRONMENT" section below for a reference on how the locale is set.
  • context: context โ€” declares the location of the nmh context file ๐Ÿ“. this can be overridden by the environment variable MHCONTEXT. see the HISTORY section 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 the msgs or msg argument 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 ๐Ÿ”ข. read mh-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". read mh-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 commands inc, rcvstore, mhshow, and show will 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. read mh-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. see mh-sequence(5) for details about private sequences. (context, no default)
  • Editor: prompter โ€” defines the editor to be used by the commands comp, dist, forw, and repl โœ๏ธ. if not set, the value will be taken from the VISUAL and EDITOR environment variables. (profile, default: prompter)
  • Msg-Protect: 600 โ€” an octal number which defines the permission bits for new message files ๐Ÿ”. see chmod(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 ๐Ÿ“๐Ÿ”’. see chmod(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 in comp, dist, forw, and repl. 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 the folder command ๐Ÿ—‚๏ธ. (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 like comp and repl to 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, the Signature profile entry is not used, so it should include a signature as well. (profile, default: userid@local.hostname)
  • Alternate-Mailboxes: mh@uci-750a, bug-mh* โ€” tells repl and scan which additional addresses are yours ๐Ÿ™‹โ€โ™€๏ธ. in this way, repl knows which addresses should be included in the reply, and scan knows 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 for ali, whom, and send ๐Ÿ“‡. this may be used instead of the -alias file switch. (profile, no default)
  • Draft-Folder: drafts โ€” indicates a default draft folder for comp, dist, forw, refile, and repl ๐Ÿ“. read mh-draft(5) for details. (profile, no default)
  • digest-issue-list: 1 โ€” tells forw the last issue of the last volume sent for the digest list ๐Ÿ“ฐ. (context, no default)
  • digest-volume-list: 1 โ€” tells forw the last volume sent for the digest list ๐Ÿ“š. (context, no default)
  • MailDrop: .mail โ€” tells inc your mail drop, if different from the default ๐Ÿ“ซ. this is superseded by the environment variable MAILDROP. (profile, default: /var/mail/$USER)
  • Signature: RAND MH System (agent: Marshall Rose) โ€” tells front-end programs such as comp, forw, and repl your mail signature โœ’๏ธ. (this is not to be confused with a .signature that might be appended to mails.) this is superseded by the environment variable SIGNATURE. if SIGNATURE is not set and this profile entry is not present, the "gcos" field of the /etc/passwd file will be used. your signature will be added to the address send puts 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:
    1. -user switch to inc, msgchk, post, send, or whom program
    2. the login name on the local machine

the password for SMTP services is the first of:

  1. password value from matching entry in file named ".netrc" in the user's home directory
  2. password obtained by interactively prompting the user

with a "file:netrc" credentials entry, the username is the first of:

  1. -user switch to program
  2. login name from matching entry in netrc file
  3. 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. like, nobody else. periodt.

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)


more coming, bestie, don't go anywhere ๐Ÿซถ

  • Welcome: disable โ€” the lil hello screen nobody asked for ๐ŸŽ€

So here's the tea: if the Welcome component isn't there at all, or its value isn't literally disable, you get a welcome message the very first time an interactive nmh program gets run after you update the nmh installation. And bestie, you must press the Enter key to continue. No skipping, no escape hatch, just Enter ๐Ÿ’…

Okay but plot twist: if the MHCONTEXT environment variable is set and non-empty (and the Welcome component isn't disable), then that welcome message only shows up if the context file contains a version reference, and that reference is older than the nmh version you've got installed. The version reference looks exactly like this, no cap:

Version: nmh-1.8

๐Ÿงš Process Profile Entries ๐Ÿงš

These profile elements are the ones that come out to play whenever an nmh program invokes some other program โ€” you know, stuff like more. And because .mh-profile is yours, you can totally swap in alternate programs if that's the vibe you want. The default values are right there in the examples below, mwah ๐Ÿ’–

Okay so the mechanics, because this part actually matters: if the profile element contains spaces, the element gets split at spaces into tokens, and each token is handed over as a separate argument to the execvp(2) system call. But if the element contains shell metacharacters, then the entire element is executed using /bin/sh. Two different rules, one component. Periodt.

  • buildmimeproc: /usr/bin/mhbuild โ€” the program whatnow uses to process drafts that are MIME composition files. She's the MIME draft handler, basically ๐Ÿ‘‘
  • fileproc: /usr/bin/refile โ€” used to refile or link a message to another folder. post uses it to file a copy of a message into a folder given by a Fcc: field. The draft folder facility in comp, dist, forw, and repl uses it to refile a draft message into another folder. And it's also used to refile a draft message in response to the refile directive at the What now? prompt. She does it all, fr fr.
  • formatproc: โ€” program called by mhl to filter a component when it's tagged with the format variable in the mhl filter. Peep mhl(5) for more info. (No default, bestie โ€” it's giving "you set this yourself" ๐Ÿ’…)
  • incproc: /usr/bin/inc โ€” program called by mhmail to incorporate new mail when mhmail is invoked with no arguments.
  • lproc: more โ€” used to list the contents of a message in response to the list directive at the What now? prompt. It's also used by the draft folder facility in comp, dist, forw, and repl to display the draft message. (Quick note: the environment variable PAGER supersedes the default built-in pager command. So PAGER really said "I'm the main character" ๐Ÿ˜ญ)
  • mailproc: /usr/bin/mhmail โ€” the program used to automatically mail various messages and notifications. send uses it to post failure notices. And it's used to retrieve an external-body with access-type mail-server โ€” like when you're storing the body with mhstore.
  • mhlproc: /usr/libexec/nmh/mhl โ€” the program used to filter messages in all sorts of ways. mhshow uses it to filter and display the message headers of MIME messages. When the -format or -filter option is used by forw or repl, mhlproc filters the message you're forwarding, or the one you're replying to. And when -filter is given to send, mhlproc filters the copy of the message that gets sent to Bcc: recipients. Versatile queen ๐ŸŒธ
  • moreproc: more โ€” used by mhl to page the mhl formatted message when displaying to a terminal. It's also the default program mhshow uses to display message bodies (or message parts) of type text/plain. (Again: the environment variable PAGER supersedes the default built-in pager command. PAGER stays undefeated ๐Ÿซถ)
  • packproc: /usr/bin/packf โ€” Currently not used. That's it. That's the whole description. She's retired, iconic, doing nothing, thriving ๐Ÿงš
  • postproc: /usr/libexec/nmh/post โ€” the program used by send, mhmail, rcvdist, and viamail (which is used by the sendfiles shell script) to post a message to the mail transport system. It's also called by whom (called with the switches -whom and -library) to do address verification.
Heads up bestie ๐Ÿšจ If your profile contains a post component and a postproc component is not present, then a warning message saying the post component will be ignored gets displayed by every nmh program that reads the profile and has its stderr associated with a terminal. So like... fix it, or enjoy the spam ๐Ÿ˜ญ
  • rmmproc: none โ€” the program used by rmm, refile, and mhfixmsg to delete a message from a folder.
  • sendproc: /usr/bin/send โ€” the program used by whatnow to actually send the message. The one that does the thing ๐Ÿ”ฅ
  • showmimeproc: /usr/bin/mhshow โ€” the program used by show to process and display non-text (MIME) messages.
  • showproc: /usr/libexec/nmh/mhl โ€” the program used by show to filter and display text (non-MIME) messages.
  • whatnowproc: /usr/bin/whatnow โ€” the program invoked by comp, dist, forw, and repl to query about the disposition of a composed draft message. She's the one asking "so... what now?" ๐Ÿ’…
  • whomproc: /usr/bin/whom โ€” the program used by whatnow to determine to whom a message would be sent.

๐Ÿ” Profile Lookup ๐Ÿ”

Okay so here's how the lookup order works, and honestly it's giving hierarchy ๐ŸŒˆ

After consulting .mh_profile, some programs 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. mhfixmsg is similar โ€” except she has no optional profile. Not her thing, and that's fine ๐ŸŽ€

The first occurrence of a component is the one that wins, e.g. .mh_profile's trumps $MHSHOW's. And a component with no value still stops further occurrences from being used โ€” but it's considered absent. So an empty value is a blocker, not a real answer. Iykyk โœจ

The .mh-profile contains only static information, which nmh programs will not update. Changes in context get made to the context file kept in the user's nmh directory. That includes, but is not limited to: the Current-Folder entry and all private sequence information. Public sequence information is kept in each folder, in the file determined by the mh-sequences profile entry (default is .mh-sequences). ๐Ÿฆ‹

And here's a fun one: the .mh-profile may override the path of the context file by specifying a context entry โ€” and bestie, that must be in lower-case. If the entry isn't absolute (doesn't start with a /), then it's interpreted relative to the user's nmh directory. As a result, you can actually have more than one set of private sequences by using different context files. Multiple identities, multiple sequence sets, main character energy all around ๐Ÿ‘‘

โœจ ENVIRONMENT โœจ

okay so bestie, nmh and all its lil commands are ALSO controlled by whatever environment variables are floating around. it's not just the profile file, it's the ~vibes of your shell~ too ๐Ÿ’…

ngl, a whole bunch of these are used internally by the โ€œWhat now?โ€ interface. and likeโ€ฆ it's genuinely amazing how much info has to get passed through environment variables just to make the โ€œWhat now?โ€ interface look squeaky clean to the nmh user, right?? ๐Ÿ˜ญ the reason for all this drama is that you can pick any program as your whatnowproc, including one of the standard shells. so passing info through an argument list? not possible, babes. the convention instead is:

  • env vars with ALL UPPER-CASE names are user-settable โ€” go off, set them ๐Ÿซถ
  • env vars with lower-case only names are used internally by nmh and should generally not be set by you ๐Ÿ™ˆ

the user-settable ones (uppercase queens ๐Ÿ‘‘)

  • HOME โ€” if it's set and non-null, it's used as your home directory. if it's not set, or it's null, then getpwuid(3)'s pw_dir gets used instead.
  • LC_ALL, LC_CTYPE, and LANG โ€” these set the locale, see locale(1). but heads up: the โ€œlocaleโ€ profile entry supersedes these. profile wins, periodt.
  • MAILDROP โ€” tells inc the default mail drop. this supersedes the โ€œMailDropโ€ profile entry.
  • MAILHOST โ€” tells inc the POP host to query for mail to incorporate. see inc(1) for more.
  • MH โ€” with this one you can specify a profile other than .mh-profile to be read by the nmh programs you invoke. if the value of MH is not absolute (i.e., doesn't 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 your nmh directory. lowkey iconic of it tbh.
  • MHBUILD โ€” specifies an additional user profile (file) to be read by mhbuild, on top of the mhn.defaults profile.
  • MHCONTEXT โ€” specifies a context other than the normal context file (as specified in the nmh profile). as usual, unless the value of MHCONTEXT is absolute, it's presumed to start from your nmh directory.
  • MHLDEBUG โ€” if this is set to a non-null value, mhl will emit debugging information. ๐Ÿ›
  • MHMTSCONF โ€” if set to a non-null value, it names the mail transport configuration file to use instead of the default, for inc, post, and other programs that talk to the mail transport system. see mh-tailor(5).
  • MHMTSUSERCONF โ€” if set to a non-null value, it names a mail transport configuration file to be read in addition to the default. see mh-tailor(5).
  • MHN โ€” specifies an additional user profile (file) to be read by mhn, in addition to the mhn.defaults profile. but bestieโ€ฆ mhn is deprecated, so support for this variable will be removed from a future nmh release. ๐Ÿ’€
  • MHSHOW โ€” specifies an additional user profile (file) to be read by mhshow, in addition to the mhn.defaults profile.
  • MHSTORE โ€” specifies an additional user profile (file) to be read by mhstore, in addition to the mhn.defaults profile.
  • MHTMPDIR, TMPDIR โ€” these are searched, in order, for the directory in which to create some temporary files. MHTMPDIR is deprecated and will be removed in a future release of nmh.
  • MHWDEBUG โ€” if set to a non-null value, nmh commands that use the Alternate-Mailboxes profile 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 โ€” tells send and post your mail signature. this supersedes the โ€œSignatureโ€ profile entry, and it is not used when the โ€œLocal-Mailboxโ€ profile component is set. ๐Ÿ‘€
  • USER โ€” tells repl your user name, and inc your default mail drop: see the โ€œMailDropโ€ profile entry.
  • USERNAME_EXTENSION โ€” this one is for use with username_extension masquerading. see mh-tailor(5).

the internal ones (lowercase, do not touch ๐Ÿ™…)

  • editalt โ€” this is the alternate message. it's set by dist and repl during edit sessions so you can peruse the message being distributed or replied to. the message is also available, when the -atfile switch is used, through a link called โ€œ@โ€ in the current directory โ€” but only 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 โ€” dist and repl set mhaltmsg to tell the whatnowproc about an alternate message associated with the draft (the message being distributed or replied to).
  • mhannotate โ€” set by dist, forw, and repl if annotations are to occur.
  • mhdist โ€” dist sets mhdist to tell the whatnowproc that message re-distribution is occurring.
  • mhdraft โ€” the path to the working draft. set by comp, dist, forw, and repl to tell the whatnowproc which file to ask โ€œWhat now?โ€ questions about.
  • mheditor โ€” set by comp, repl, forw, and dist to tell the whatnowproc the user's choice of editor (unless overridden by -noedit).
  • mhfolder โ€” the folder containing the alternate message. set by dist and repl during edit sessions so you can peruse other messages in the current folder besides the one being distributed or replied to. mhfolder is also set by next, prev, and show for use by mhl.
  • mhinplace โ€” set by dist, forw, and repl if annotations are to occur.
  • mhmessages โ€” set by dist, forw, and repl if annotations are to occur.
  • mhuse โ€” this may be set by comp.

๐Ÿ“ FILES ๐Ÿ“

  • $HOME/.mh-profile โ€” the user's profile. your main character document fr ๐Ÿ’–
  • <mh-dir>/context โ€” the user's context
  • <folder>/.mh-sequences โ€” public sequences for <folder>

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

mhbuild(1), mhshow(1), mhstore(1), mh-sequence(5), nmh(7), post(8)


๐Ÿ› BUGS ๐Ÿ›

so there's some question as to what kind of arguments should even go in the profile as options. and to give you a clear answer, let's 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 โ€” like message sequences, filenames and folders โ€” are always remembered on the invocation line and are not superseded by following arguments of the same type.

so the takeaway? it is safe to place only switches (and their arguments) in the profile. that's it, that's the rule ๐Ÿ’…

now, if you find yourself invoking an nmh program again and again with the same arguments, and those arguments aren't switches, there are a few possible solutions to this problem:

  1. 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 that nmh command. ๐ŸŽ€
  2. similarly, you could create a small shell script which called the nmh program of your choice with an alternate set of invocation line switches. but ngl โ€” using links and an alternate profile entry is preferable to this solution. just saying.

finally, the csh user could create an alias for the command of the form:

alias cmd 'cmd arg1 arg2 ...'

this way you can avoid lengthy type-in to the shell and still give nmh commands safely. (and recall, bestie: some nmh commands invoke others, and in all cases the profile is read โ€” meaning aliases are disregarded beyond an initial command invocation. so don't get too comfy with them ๐Ÿ˜ญ)


and that's a wrap on MH-PROFILE(5)! this whole thing came to you from nmh-1.8, dated 2016-10-19 โ€” a lil vintage, a lil iconic, very much still serving ๐Ÿซถโœจ go forth and configure responsibly ๐Ÿ’–๐ŸŒธ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from