Versions of forw

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

This section has one version of forw that calls a specialized editor script to edit a message before it's forwarded. The second MH version is actually a version of repl, acting like forw to work around a problem with MIME forwarding.

Use forw to Resend a Returned Message

You've probably received a few returned mail messages like the one below. Usually, after you figure out what went wrong, you want to resend the message. The resend program helps you do that. It's a version of the forw command. It has an -editor shell script called resend.fixmsg that removes everything from the forwarded draft except the original message, then puts you into an editor to do any other cleanup. The resend.fixmsg script is in this book's online archive.

How well does it work? I've used resend for about four years now, and it works quite well at the sites where I've tried it. You may have to tweak it for your site. But, when it doesn't work, ed (the editor it uses to clean up the draft noninteractively) usually just prints a question mark (?) and leaves the forwarded draft alone -- resend.fixmsg pops me into vi, I edit the draft by hand and send it. Here is an example of resend:

% comp
	...
What now? push
%
	...Time passes...
You have new mail.
% inc
  45+ 01/09 MAILER-DAEMON      Returned mail: Host unknown
% show
	...Nasty-gram from MAILER-DAEMON...
% resend
	...My editor (vi) starts...
	...I fix the address...
What now? push
% rmm
%
The resend.fixmsg script is in this book's online archive. See Section Explanation of resend for details.

Filter Forwarded MIME Messages: mforw

The forw -mime option creates a draft message with mhn #forw directives. When you process the directives through mhn, it will include all of the fields from the forwarded message headers -- including fields like Received: that people usually don't want to see. The forw switches -filter and -format, which can remove these fields, don't work with -mime.

The mforw command version lets you use -filter with -mime. Unlike forw, mforw can forward only one message at a time. This is because mforw actually uses repl, not forw, to forward the message. mforw uses an mhl filter file named mforwfilt to include the parts you choose of the original message; it adds an mhn #<message/rfc822 directive above the forwarded message. You can type notes before the message you forward. (But, to type notes after the message you forward, you'll need to add an mhn #<text directive before your notes.)

For example:

% mforw
To: ehuser
cc:
Subject: About the meeting on Friday
------
Emma, here's a note from Al about the meeting.
See you there!

CTRL-D

What now? list    ...to see draft...

To: ehuser
Subject: About the meeting on Friday
------
Emma, here's a note from Al about the meeting.
See you there!
#<message/rfc822 [Forwarded message]
Date: Mon, 09 Jan 1995 09:49:08 -0500
From:  Al Bok <al@phl.ph.com>
To: jerry@ora.com
Subject: The idea I'd like to discuss Friday

Jerry,
    ...

What now? e mhn

What now? s
Of course, if you've set an automhnproc, you won't need to type edit mhn. Here's how to add mforw:
  1. Make a file named mforwfilt in your MH directory:
    ; filter file for mforw (version of repl)
    :#<message/rfc822 [Forwarded message]
    nocomponent,width=10000
    ignores=return-path,message-id,received,replied,forwarded,resent
    extras:
    :
    body:
    
    You may want to edit the ignores= variable to change the header fields that mforw excludes. The Section Formatting the Message Header covers that part of mhl.
  2. To make mforw as a version of repl (note: not a version of forw!), see the Section Making a New Command Version. Or, to make an alias or function, see the Section Writing Command Versions as Aliases or Functions.

    Add this entry to your MH profile, or add the arguments to your alias or function:

    mforw: -filter mforwfilt -form forwcomps
    
  3. mforw requires prompter -prepend. If you've added the -noprepend switch to your prompter: profile entry, and you want prompter to stay that way by default, you'll also need to create a version of prompter that uses -prepend. (Otherwise, skip this step.) For instance, you could make a version named prompter.pre by following the steps in the Section Append Text with prompter.nopre and using the -prepend switch in the prompter.pre: profile entry. Then add -editor prompter.pre to your mforw: profile entry.

[Table of Contents] [Index] [Previous: msg: `While You Were Out' Messages with comp] [Next: Edit Messages with show: mhedit]


Last change $Date: 1996/06/06 15:14:55 $

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 <jerry@ora.com>

HIVE: All information for read only. Please respect copyright!
Hosted by hive КГБ: Киевская городская библиотека