FORW(1mh)
π forw β forward nmh messages π
okay bestie, so forw is the nmh command that takes messages you already have and builds a brand new message out of them. It reads a forms (components) file, sticks the message(s) you're forwarding into the body, opens an editor for you, and then β once you're done editing β it asks you before actually sending anything. no accidental sends here, we're safe π«Ά
πΈ SYNOPSIS πΈ
forw [-help] [-version] [+folder] [msgs] [-annotate | -noannotate]
[-form formfile] [-format | -noformat] [-filter filterfile]
[-inplace | -noinplace] [-mime | -nomime] [-draftfolder +folder]
[-draftmessage msg] [-nodraftfolder] [-editor editor] [-noedit]
[-width columns] [-from address] [-to address] [-cc address] [-fcc
+folder] [-subject text] [-whatnowproc program] [-nowhatnowproc]
[-dashstuffing | -nodashstuffing] [-build] [-file msgfile]
forw [-help] [-version] [+folder] [msgs] [-digest list] [-issue number]
[-volume number] [other switches for forw]
β¨ DESCRIPTION β¨
so basically, forw constructs a new message from a forms (components) file, and the body of that message is composed of the message(s) you're forwarding. An editor gets invoked, and after you finish editing, the user is prompted before the message is sent. periodt.
The default message template tells forw to build the draft like this:
From: {from switch} or <Local-Mailbox> or <username@hostname>
To: {to switch} or blank
Fcc: {fcc switch} or +outbox
Subject: {subject switch} or "{original subject} (fwd)"
--------
If there's a file called forwcomps chillin' in your nmh directory, that one gets used instead of the default form. You can also point at a different forms file with -form formfile. Forms get processed through the nmh template system, so peek at mh-format(5) for the deets. Components from the first forwarded message are available as standard component escapes in the forms file. π
On top of the standard mh-format escapes, these component escapes are also supported:
Escape Returns Description
fcc string Any folders specified with `-fcc folder'
nmh-from string Addresses specified with `-from address'
nmh-to string Addresses specified with `-to address'
nmh-cc string Addresses specified with `-cc address'
nmh-subject string Any text specified with `-subject text'
By default, the To: and cc: fields are empty. You can add addresses to them with -to address and -cc address β and yes, you can give these switches multiple times to add multiple addresses. stack 'em up π
By default, the From: field holds either the value of the Local-Mailbox profile entry, or a system default email address. Want to override it? Use -from address. The default mailbox in the Fcc: field is +outbox, and you can override that with -fcc.
Any text you hand to -subject goes straight into the Subject: field in the draft.
If the draft already exists, forw will ask you what you want to do with it. Answer quit and forw aborts, leaving the draft intact. Answer replace and the existing draft gets swapped for a blank skeleton. Answer list and it shows you the draft.
If you give the -annotate switch, every message being forwarded gets annotated with these lines:
Forwarded: date
Forwarded: addrs
where each address list has as many lines as it needs. π This annotation only happens if the message is sent directly from forw. If it's not sent immediately from forw, you can use comp -use to re-edit and send the constructed message β but the annotations won't take place. Normally annotations are done in place so any links to the message are preserved. You can change that with -noinplace.
For a description of the -editor and -noedit switches, go see comp(1).
Even though forw uses a forms (components) file to construct the initial draft, a message filter file is what formats each forwarded message in the body of the draft. The filter file for forw should be a standard form file for mhl(1), since forw invokes mhl to filter (re-format) the forwarded messages before they get output to the body of the draft.
The switches -noformat, -format, and -filter filterfile decide which message filter file gets used. If -noformat is specified (and yes, that's the default), then each forwarded message is output into the draft exactly as it appears, with no mhl filtering. If -format is specified, then this default message filter file β mhl.forward β gets used, and honestly it should be adequate for most users:
; mhl.forward
;
; default message filter for `forw' (forw -format)
;
width=80,overflowtext=,overflowoffset=10
leftadjust,compress,compwidth=9
Date:formatfield="%<(nodate{text})%{text}%|%(tws{text})%>"
From:
To:
cc:
Subject:
:
body:nocomponent,overflowoffset=0,noleftadjust,nocompress
If a file named mhl.forward exists in your nmh directory, that one gets used instead. And you can specify an alternate message filter file with the switch -filter filterfile.
Each forwarded message is separated with an encapsulation delimiter. By default, any dashes in the first column of the forwarded messages get - prepended to them, so that when received, the message is suitable for bursting by burst(1). This follows the guidelines in RFC 934. Use -nodashstuffing to suppress this form of quoting.
Users of prompter(1) can, by specifying prompter's -prepend switch in the .mh_profile file, prepend any commentary text before the forwarded messages. π¦
To use the MIME rules for encapsulation, specify -mime. That directs forw to generate an mhbuild composition file. Note that nmh will not invoke mhbuild automatically β you have to specifically give the command
What now? mime
before sending the draft. don't forget it bestie π
The -draftfolder +folder and -draftmessage msg switches invoke the nmh draft folder facility. This is an advanced (and highly useful) feature β consult mh-draft(5) for more.
The -editor editor switch tells it which editor to use for the initial edit. When you exit the editor, comp invokes the whatnow program. See whatnow(1) for a discussion of available options. You can inhibit the invocation of this program with the -nowhatnowproc switch. (Fun fact: it's actually the whatnow program that starts the initial edit, so -nowhatnowproc will prevent any edit from occurring at all.) π
The -build switch is intended for the Emacs mh-e interface to nmh. It implies -nowhatnowproc. It causes a file <mh-dir>/draft to be created, containing the draft message that would normally be presented to the user for editing. No mail is actually sent. π
The -file msgfile switch specifies the message to be forwarded as an exact filename rather than as an nmh folder and message number. This switch implies -noannotate. The forwarded message is simply copied verbatim into the draft; the processing implied by the -filter, -mime, and -digest switches is bypassed, and the usual leading and trailing 'Forwarded Message' delimiters are not added. The same caveats apply to this option as to the -build switch.
The -digest list, -issue number, and -volume number switches implement a digest facility for nmh. Specifying these switches enables and/or overloads these escapes:
Type Escape Returns Description
component digest string Argument to `-digest'
function cur integer Argument to `-volume'
function msg integer Argument to `-issue'
ποΈ FILES ποΈ
forw looks for format and filter files in multiple locations: absolute pathnames are accessed directly, tilde expansion is done on usernames, and files are searched for in the user's Mail directory as specified in their profile. If it's not found there, the directory /etc/nmh is checked.
/etc/nmh/forwcompsβ The default message skeleton.<mh-dir>/forwcompsβ The user's message skeleton./etc/nmh/digestcompsβ The default message skeleton if-digestis given.<mh-dir>/digestcompsβ The user's-digestskeleton.^/etc/nmh/mhl.forwardβ The default message filter.<mh-dir>/mhl.forwardβ The user's message filter.^$HOME/.mh_profileβ The user's profile.
π PROFILE COMPONENTS π
Path:β To determine the user's nmh directory.Current-Folder:β To find the default current folder.Draft-Folder:β To specify the default draftfolder.Editor:β To override the default editor.Msg-Protect:β To set mode when creating a new message (draft).fileproc:β Program to refile the message.mhlproc:β Program to filter messages being forwarded.whatnowproc:β Program to ask the "What now?" questions.
π SEE ALSO π
burst(1), comp(1), mh-draft(5), mh-format(5), mhbuild(1), mhl(1), prompter(1), repl(1), send(1), whatnow(1)
Proposed Standard for Message Encapsulation (RFC 934)
β DEFAULTS β
+folderβ The current folder.msgsβ The current message.-noannotate-nodraftfolder-noformat-inplace-dashstuffing-nomime
π CONTEXT π
If a folder is given, it becomes the current folder. The first message forwarded becomes the current message.
π¨ BUGS π¨ (not me, the actual bugs)
If whatnowproc is whatnow, then forw uses a built-in whatnow β it does not actually run the whatnow program. So if you define your own whatnowproc, don't call it whatnow, because forw won't run it. π
When forw is told to annotate the messages it forwards, it doesn't actually annotate them until the draft is successfully sent. If, from the whatnowproc, you push instead of send, it's possible to confuse forw by re-ordering the file (e.g. by using folder -pack) before the message is successfully sent. dist and repl don't have this problem.
okay that's the whole page, you ate that π
this was nmh-1.8, dated 2022-12-22, and it's the FORW(1mh) manual β go forward some mail, bestie, you've got this π
π¦ 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