Forwarding Messages with forw

[previous] [next] [table of contents] [index]

The forw command lets you send copies of one or more messages to other people. Here is an introduction to forw.

Formatting Forwarded Messages

By default, every line of the message(s) you're forwarding is sent. If a message header is full of "junk" fields like Received: xxx, you can save space on the copy you forward by telling forw to omit those fields. You can also control the formatting of the rest of the header and/or body -- line up header fields neatly or rearrange them into a standard order, shorten lines in the body that are too long, and so on.

It's easy to get the most common formatting. If you use the -format switch, forw will process the message(s) you're forwarding with an mhl filter file. Your system should have a standard file called mhl.forward that:

To use it, just type:
% forw -format
If you want to use this filtering on most of the messages you forward, you may want to add this entry to your MH profile:
forw: -format
Before forw checks the MH library directory for an mhl.forward file, it looks in your MH Mail directory. If you don't like the system mhl.forward file, you can copy the system mhl.forward file into your directory and then edit it:
% cd Mail
% cp /usr/local/lib/mh/mhl.forward .
% vi mhl.forward
(You'll need to change the /usr/local/lib/mh if your system's MH library directory is someplace else.)

forw gives you another choice: using a different filter file than mhl.forward. That can be handy if you forward different kinds of messages. You might have a second filter file that includes Resent: fields from the original message, a third filter file that reformats the message body for a friend who has a 40-character-wide display, and so on. The Section forw Filter Files explains how to make your own.

If you set -format or -filter as a default in your MH profile, you can override either one of those switches by using -noformat as you type the forw command line.

Adding Text to the Draft

By default, forw will prompt you for the header fields; then it prompts you to:
--------Enter initial text
After you enter the initial text, forw will scroll the body of the forwarded message(s) across your screen. The "initial text" gives you a chance to type some extra text -- for instance, you could write a note to the people who you're forwarding this to.

But you may not like the way that works. If you want the note you write to go after the forwarded message(s), add the -noprepend switch to the prompter: entry in your MH profile. Unfortunately, though, that changes the way prompter works for all message-sending commands, not just forw. The Section Append Text with prompter.nopre has a solution.

Leave My Dashes Alone

Another thing some people don't like about forw is the way that it adds an extra dash and space (- ) before any line which starts with a dash. For example, text that looks like this in the original message:
- Add one cup water.
  Stir.
- Cook for 25 minutes.
will be forwarded this way:
- - Add one cup water.
  Stir.
- - Cook for 25 minutes.
That's special formatting called "bit stuffing" that helps the MH burst command split forwarded messages back into separate message files. (There's a detailed description in RFC 934; see the Reference List.) One problem with that format comes when messages are nested many levels deep: the lines starting with dashes can get so long that they may be truncated by some message transports. Or you may not like the extra stuff (- ) at the beginning of dashed lines. The forw -mime switch forwards messages without bit-stuffing. (On the other hand, forw -mime -rfc934mode uses a MIME format that simulates bit-stuffing.) Not everyone has MIME yet, though. So you also can use the almost undocumented -nodashmunging switch. (It's mentioned in "The RAND MH Message Handling System: Administrator's Guide, UCI Version.")

Of course, you should not use -nodashmunging if the person you send the message to will want to burst it. And because it isn't documented, don't depend on -nodashmunging staying in MH forever.

The -nodashmunging switch only works in combination with -format or -filter and a filter file:

% forw -nodash -format
If you don't want any formatting, you can't use both -noformat and -nodashmunging to get it. The best answer for that is probably a filter file that does no formatting. Here's one that I call mhl.noformat; you can put it your MH directory:
width=10000
extras:nocomponent
:
body:nocomponent
If you want long body lines wrapped after the 79th character, add ,width=80 (with no space before it) to the end of the last line.

You use mhl.noformat by typing its name on the command line (which overrides any default mhl.forward), like this:

% forw -filter mhl.noformat -nodashmunging
mhl.noformat doesn't delete any header fields, and it leaves long lines as they are in the original message. For more information, see the Section forw Filter Files.

Make Your Messages burst-able

It's always a good idea to leave a blank line between the initial text you type (if any) and the starting line (------- Forwarded Messages). That's because the message encapsulation guidelines in the document RFC 934 say that there must be a blank line before the forwarded messages. This lets message-bursting programs like burst separate the header of the total message from the header of the first forwarded message. If you enter initial text, be sure to press RETURN at least one extra time after you finish.

You don't have to follow this rule when you're forwarding a message with the MIME #forw directive -- before you encode the message. After you encode it with edit mhn, though, you should be careful about the space between the parts. Also see the Section Forwarding in MIME Format.

No Need for forwcomps

When forw prompts you for To:, cc:, and Subject:, it reads a default header file called forwcomps from the MH library directory. You can make your own forwcomps file -- in your MH directory. But forwcomps has the same syntax as the components file that comp uses. Because I want the same default header for both forw and comp, I tell forw to use my components file instead. So if I ever change my components file, I won't have to remember to change forwcomps, too. This entry in your MH profile does the job:
forw: -form components

Annotating the Original Message

If you use the -annotate switch on the forw command line or in your MH profile, the message you forward will have fields like this added to its header:
Forwarded: Mon, 09 Jan 1995 09:13:52 -0500
Forwarded: al@phlabs.ph.com
These let you know that you forwarded the message to al@phlabs and when you did it. There will be one Forwarded: user@host field for each address you forward the message to.

By default, scan looks for Replied: fields in messages, but it doesn't look for Forwarded: fields. If you want to, you can add that yourself, though; see the Section More Header Information: scan.hdr.

Creating Digests

The forw command can create message digests. Digests combine one or more messages in a format similar to an MH forwarded message. Digests are usually sent periodically to a list of users (a mailing list). Each digest message has its own volume and issue numbers; MH can keep track of these for you and increment them automatically. (The numbers are kept in the context file. The Section Settings from the MH Profile shows how to get the volume and issue numbers for the last digest sent.)

Here's an example. You're taking over as moderator of the octopus-eaters mailing list. Before the first issue, you store the recipients' addresses in an alias named dist-octopus-eaters. You ask your system postmaster to create a system alias named octopus-eaters-request with your name; this is where people send mail if they want to be added to or deleted from the mailing list. The first issue you're sending is volume 1, issue 26. To send messages 25-34:

% forw -digest octopus-eaters -volume 1 -issue 26 25-34
From:     octopus-eaters-Request
To:       octopus-eaters Distribution: dist-octopus-eaters;
Subject:  octopus-eaters Digest V1 #26
Reply-To: octopus-eaters

--------Enter initial text

Hi.  I'm Emma H. User, the new moderator of octopus-eaters.
Send submissions to: octopus-eaters@bigcorp.com.

CTRL-D

octopus-eaters Digest   Thursday, 25 Jul 1991
                Volume 1 : Issue 26

Today's Topics:

	...Messages appear...

End of octopus-eaters Digest [Volume 1 Issue 26]
************************************************
--------

What now?
The header setup can be stored in your MH directory in a replcomps-style file named, by default, digestcomps. You can customize digestcomps. If you run more than one digest, creating some versions of forw can save time.

For the next issue, just type forw -digest octopus-eaters. MH will automatically assign volume 1, issue 27, unless you override it.

Another way to create message digests is the forw -mime switch. It doesn't have the nice numbering and formatting features of forw -digest, though.

Forwarding in MIME Format

The forw -mime switch simply builds a draft message with a #forw directive in it. (Parts of the Section Composing and Sending MIME Messages cover #forw.) If you encode the draft with the mhn -rfc934mode switch, mhn will simulate RFC 934-style "bit stuffing," as in the Section Leave My Dashes Alone.

Another way to forward in MIME format is to use comp -- and put #forw directives in the draft. This lets you forward messages from more than one folder. It won't annotate the messages you forward, but you can use the anno command to add Forwarded: fields to the original messages.

One disadvantage of forw -mime (compared to plain forw) is that it overrides the -filter and -format switches. All header fields, including "useless" fields like Received:, are copied from the forwarded messages. (Actually, as with many MH switches, the order that forw reads the switches determines which switch will "win." The last switch in the group -mime, -filter and -format is the one that's used. forw reads the MH profile before reading its command line. So, if you have -filter in your MH profile and you run the command forw -mime, the -mime switch will override -filter. As another example, if you type forw -mime -format, the -format switch will win because it comes last on the command line.)

If you want to use MIME format but you also want to filter out useless header fields, see the trick in the Section Filter Forwarded MIME Messages: mforw. The mforw version shown there is actually a link to the repl command that edits a message and forwards it in MIME format. That mforw version only forwards one message at a time, though. To forward several messages with cleaned-up headers or to build a MIME digest, the easiest method I know is to use forw -mime; run edit mhn; then edit the message by hand (with a command like edit emacs).

[Table of Contents] [Index] [Previous: Replying to Mail with repl] [Next: Distributing Messages with dist]


Last change $Date: 1996/06/06 15:10:20 $

This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.

Suggestions are welcome: Jerry Peek <jpeek@jpeek.com>