MHMAIL(1)
π MHMAIL(1) β the mhmail manual, but make it make sense
okay bestie, gather round π this is mhmail, section 1 of the General Commands Manual, and it's the nmh-adjacent glow-up of everybody's favourite crusty Berkeley mail situation. let's get into it π¦
β¨ NAME β¨
mhmail β send or read mail non-interactively with nmh π
β¨ SYNOPSIS β¨
mhmail [-help] [-version] [-to] addrs ... [-attach file] [-body text]
[-cc addrs ...] [-from addr] [-headerfield name:value] [-subject
subject] [-resent] [switches for post ... | -profile [switches for
send ...]] [-send | -nosend]
mhmail with no arguments is equivalent to inc
β¨ DESCRIPTION β¨
so mhmail is basically the replacement for the standard Berkeley mail program (mail or mailx), and it's designed to be compatible with nmh. the whole point of it is that nmh is meant for programs like cron that just want to send mail automatically, no vibes, no conversation, no "are you sure?" β it also gets used by some nmh commands to mail out error notifications. and yeah, you can use mhmail interactively, but lowkey don't π«Ά if you're a human sending a message, the manual literally recommends comp and send instead.
when you run it with no arguments at all, mhmail just calls inc to incorporate new messages from your mail drop. that's it. that's the whole vibe.
when you give it one or more addresses, it reads a message from standard input and spools it to a temporary file. then mhmail invokes, by default, with the name of the temporary file as its argument, to by default, with the name of the temporary file as its argument to deliver the message to the specified address. π yes that sentence is like that in the original, i'm just the messenger, no cap.
the -subject switch can be used to specify the "Subject:" field of the message. "Subject:" field of the message. β¨ (again: the original says it twice. iconic of it.)
the -resent switch means the message body is a fully formed message that will be resent, the way dist would do it. for example:
mhmail u2@example.com -resent <`mhpath cur`
by default, mhmail reads the message to be sent from standard input. but you can put the text of the message right on the command line with the -body text switch. here's the important bit π if standard input has zero length, mhmail will not send the message and will return with status 1. if you genuinely want an empty message, you have to force it with -body "".
normally, addresses that show up as arguments get dropped into the "To:" field. and at least one such address is required when sending a message, i.e. if you supply any other switches at all. if you use the -cc switch, then all addresses following it β even if there are intervening switches other than -to β go into the "cc:" field. the optional -to switch can appear in front of any addresses to signify that they belong in the "To:" field. and yes, -to and -cc can each be given multiple times. π
with -from addr you can specify the "From:" header of the draft. if no -from switch is used when sending, mhmail will supply a "From:" header field using the sender's local mailbox β see localmbox in mh-format(5). naturally, post will fill in the "Sender:" header correctly. π
the -headerfield name:value switch adds a header field with the specified name and value to the message. (fun fact: the value is called the field body in RFC 2822, but that's too easily confused with the message body, so we're not doing that.) there need not be a space after the colon separating the name and value in the argument to this switch. it is usually best to enclose the argument in quotes to protect it from the shell. and -headerfield may be given multiple times to add multiple header fields, like:
mhmail -from sender@example.com \
-headerfield 'MIME-Version:1.0' \
-headerfield 'Content-Type:text/plain; charset=utf-8' \
-headerfield 'Content-Transfer-Encoding:8bit' \
recipient@example.com
note about this example, bestie: the -attach switch causes MIME-Version and Content-Type headers to be added to the message. π
the -profile switch tells mhmail to use send instead of post to send the message. this lets you use your context and your aliases. slay.
the -attach file switch attaches the specified file to the message. using -attach enables -profile, because mhmail uses send to handle the attachment. usually best to enclose the argument in quotes to protect it from the shell. and -attach may be given multiple times to add multiple attachments. πΈ
the -nosend option shows the draft file that would be posted/sent on the command's standard output, but does not post or send it. -send gives you the default behaviour of posting or sending the message, and it can be used to disable -nosend β for example, when you're using a shell alias.
all other switches get passed to post if -profile is not used, or to send if -profile is used. periodt.
β¨ FILES β¨
/usr/bin/incβ Program to incorporate mail drop into folder/usr/libexec/nmh/postβ Program to deliver a message/tmp/mhmail*β Temporary copy of message
β¨ PROFILE COMPONENTS β¨
mhmail does not consult the user's .mh_profile π
β¨ SEE ALSO β¨
dist(1), send(1), mh-format(5), send(1), post(8)
β¨ DEFAULTS β¨
-from localmbox-profileis enabled by default only with-attach-send
β¨ CONTEXT β¨
if inc is invoked, then inc's context changes occur. with the -profile switch, the context of send is used. mhmail does not read the context file itself.
and that's the whole page, bestie π no notes, ate, left no crumbs. this was nmh-1.8, dated 2012-07-01 β yeah she's a vintage queen π thanks for reading, mwah π«Άπ β¨
π¦ 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