MH & nmh: Email for Users & Programmers

May, 2006

Distributing Messages with dist

The forw and dist commands do similar things. But dist is designed for resending (distributing) messages without any changes or extra text in the body. This means that the people who receive a dist'ed message from you will see it as:

    From: whoever-sent-it-to-you
    Date: whenever-original-was-sent
    
instead of:
    From: you
    Date: whenever-you-forwarded-the-copy
    
For example, let's say that Norm sent a message to Mary on May 13. Then, on June 24, Mary sent two copies of the message to Mike as a test -- the first copy was with dist, and the second copy was with forw. Here's what Mike would see in his scan listing of the two copies of the same message:
    1755+ 05/13 Norman Schwartzko  Summary of the Zeta project<<This is
    1756  06/24 Mary Shepley-Hunt  Zeta info<<----- Forwarded Messages
    
You can dist only one message at a time (forw lets you forward several messages as a unit). Here's an example:
    % dist 23
    Resent-To: bigboss
    Resent-cc:
    --------

    CTRL-D
    --------

    What now? send
    
If you try to add extra text (besides the Resent- fields), send will ask you to "please re-edit draft to consist of headers only!" The distprompter shell script will prevent this error and make dist easier to use.

The people who receive the resent message will get the original message with these three fields added (or four, if you filled in Resent-cc:):

    % inc
        ...
    % show
        ...
    Resent-To: bigboss
    Resent-Date: Mon, 09 Jan 1995 07:33:22 -0600
    Resent-From: ehuser (Emma H. User)
        ...
    
Otherwise, the recipients' copies of the message will be identical to yours.
NOTE: dist (actually, the send command) can't resend a message from a read-only folder (explained in the Section Sharing Other Users' Folders). When you try to send the message, it gives you an error like:
      send: unable to link xx/yy/zz/83 to
      /xx/yy/zz/send012817: Permission denied.
      
One easy workaround is the rcvdist command. rcvdist is in your system's MH library directory. Put the addresses on the command line; redirect the standard input of rcvdist to the message file. Use mhpath in backquotes to get the message file pathname. For example, to resend the current message to ehuser@xyz.edu and fred@snora.com, type:
      % /path/rcvdist ehuser@xyz.edu fred@snora.com < `mhpath cur`
      
The forw command also works from read-only folders.

A distcomps File

You can add a few other fields to the header besides the default Resent-To: and Resent-cc: by editing the draft header or putting a distcomps template file in your MH directory.

Annotating the Original Message

If you use the -annotate switch on the dist command line or in your MH profile, the message you resend will have fields like this added to its header:

    Resent: Mon, 09 Jan 1995 09:13:52 -0500 Resent: al@phlabs.ph.com
    
Otherwise, this works just like forw -annotate.

distprompter Edits dist Drafts

distprompter is an editor designed for dist. It's also an example of writing your own draft message editor.

By default, dist uses prompter to edit the draft. prompter isn't a great editor for dist, because if you accidentally type a message body after the row of dashes, the message can't be sent. Also, you always have to press CTRL-D to skip the body and get the What now? prompt.

Besides fixes for the two problems listed above, distprompter acts a lot like prompter:

To use distprompter, type its name on the dist command line or add it to your MH profile:
    dist: -editor distprompter
    
Another section explains how to set up distprompter.