MH-MIME(7mh)
mh-mime(7mh) β the MIME tea, served piping hot π
okay bestie, sit down, grab a strawberry lemonade π, because we're about to spill the entire lore of mh-mime, section 7 of the nmh manual. this is the overview page for how the whole nmh fam handles MIME, and honestly? it's giving "group project where not everyone did their part" but we'll get to that.
β¨ NAME β¨
mh-mime β the whole entire rundown on nmh MIME message composition and display π
πΈ DESCRIPTION πΈ
okay so first things first: MIME stands for Multipurpose Internet Mail Extensions, and it's the format of Internet messages used to send multi-media content. like, this is how your cute little email carries a photo AND text AND a PDF all at once. iconic behavior fr.
the nmh command suite does have support for displaying and composing MIME messages... but currently MIME support is not completely integrated into all the tools. yeah. we said it. π
so this document is basically the vibe check: it tells you which tools support MIME message display, storage, and composition. let's go.
π€ Local Character Set Conversion π€
all of the nmh commands convert non-native character sets to the local character set, as specified by the operating system locale settings. the locale is doing the heavy lifting here, no cap.
see locale(1) for more details on the environment variables used to set the local character set. π«Ά
β οΈ heads up bestie: character set conversion will only take place if nmh was built withiconv(3)support. seemhparam(1)for how to determine whether your nmh installation includesiconv(3)support.
and depending on the source and target character set, it may not be possible to convert all the characters to the local character set. when that happens? a substitution character gets used for the characters that cannot be converted. it's the "we don't have that one, here's a stand-in" moment. π
π Message Display π
the default format used by scan(1) will automatically decode MIME-encoded headers. slay. no manual labor required.
but if you have a custom scan format? you're on your own a little bit β go look at the examples provided with the nmh distribution (they live in the "/etc/nmh" directory) and check mh-format(5) for details on how to make sure your MIME headers are properly decoded. iykyk. β¨
by default, if show detects that it is reading a MIME message, it will invoke mhshow(1). and the default behavior of mhshow is to only display text parts that are not marked as attachments. yes, only the non-attachment text parts, bestie.
see mhshow(1) for details on how to control what mhshow will display. π
π Message Interrogation and Storage π
the mhlist(1) command will display a listing of the MIME parts contained within a message. it's basically the "what's inside this thing" tool.
that info can be used in conjunction with the mhstore command to save individual parts or content types of a message. so like, you can grab just the one part you want instead of the whole entire message. periodt. π
see mhlist(1) and mhstore(1) for more details on how these commands work.
βοΈ Message Composition and Reply βοΈ
all messages sent by send(1) will automatically be processed by mhbuild(1) before being passed to post(1) for message submission. the pipeline is real and it is running. π₯
mhbuild will use the locale settings to mark text content with the appropriate character set and apply any necessary encoding.
now, if you wish to include text in your message using a character set that does not match your locale, you will need to specify the character set using an mhbuild directive. see mhbuild(1) for more information. don't just hope it works, bestie. π
for attaching files or composing other non-text content, there are two options:
- the attach system
- mhbuild directives
π the attach system π
the attach system is best suited for content where one or more files are being attached to a message.
you can use the attach system by either:
- using the
attachcommand at the"What now?"prompt, or - inserting an
"Attach:"header in the message draft containing the name of the file you wish to attach to the message
π«Ά fun fact (and by fun i mean important): note that all theattachcommand does is place an"Attach:"header in the message draft. that's it. that's the whole job.
mhbuild will then automatically include the specified file(s) in the outgoing message. see send(1) for details on how mhbuild determines the proper content type of attached files.
π§ the mhbuild directives method π§
the other method of composing MIME messages is to use mhbuild directives. this allows exact control over the contents and format of the MIME message, but it has a more complicated syntax. main character energy, higher skill ceiling, you get it. π
mhbuild(1) contains details on the directive syntax and examples of directives for different media types.
β οΈ it is important to note that when usingmhbuilddirectives the user must runmhbuildoutside ofsendto have it process directives. when being run bysend,mhbuildis configured to not process directives so normal user text is not mistaken for a directive. so don't come forsend, it's doing that on purpose. π
when using directives a user typically uses the mime command at the "What now?" prompt to process them.
π¬ replying, the tricky part π¬
when replying to messages using repl(1), the traditional MH method of including the original text in the reply does not interoperate with MIME messages. yeah. it's giving incompatibility. π
the -convertargs switch to repl(1) provides one solution. π
another solution: the contrib directory (/usr/share/doc/nmh/contrib) contains a Perl program called replyfilter which will decode text parts and present them in an appropriate manner to be included in a message reply. see the comments at the top of replyfilter for instructions on how to configure nmh to work with it. π
π§ Message Rewrite π§
the mhfixmsg(1) command can apply various transformations to MIME messages, including:
- decoding of text parts
- converting the character set of text parts
- insertion of
text/plainparts to correspond to text parts of other subtypes
mhfixmsg can also repair defects in MIME messages, such as mismatched top-level boundary indicators and invalid Content-Transfer-Encoding values. it's the glow-up artist for your broken MIME. π
π¦ SEE ALSO π¦
comp(1)iconv(3)mh-format(5)mhbuild(1)mhfixmsg(1)mhparam(1)nmh(7)repl(1)whatnow(1)/usr/share/doc/nmh/contrib/replyfilter/usr/share/doc/nmh/contrib/replaliases
π BUGS π
MIME support should be more integrated into all of the nmh tools than it currently is.
and that's the whole thing. we said what we said. π
and that's a wrap on this page, bestie π this was nmh-1.8, dated 2014-12-15, page MH-MIME(7mh) β go forth and MIME responsibly, mwah π
β¨
π¦ 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