MH & nmh: Email for Users & Programmers

May, 2006

Bursting Messages

When MH forwards message(s) with forw, or makes a digest with forw -digest, it uses a special format called bit stuffing. That format makes it easy for the recipient to extract the "encapsulated" messages, one by one. The MH burst command does this; it splits (bursts) the group into separate messages. Recent versions of burst also handle MIME-encoded digests (see the Section Forwarding in MIME Format, forw -mime).

The next example shows the basics of burst. First, there's a forwarded message which contains three other messages (to save space, the middle of each message isn't shown). Notice that the original message has two lines of text after the last forwarded message. Next, the message is burst with the -verbose switch (which tells you what's happening but isn't required). Finally, a scan shows that the folder now has the three burst messages, as well as the original:

    % scan
       1+ 01/13 To:daved           Mail questions I told you about
    % show
    (Message inbox:1)
    To: daved
    Subject: Mail questions I told you about
    Date: Fri, 13 Jan 1995 20:13:46 -0400
    From: ehuser

    Dave, here are the questions we were discussing.
    Hope they're what you wanted.

    ------- Forwarded Messages

    Date:    Mon, 09 Jan 1995 00:28:18 +0000
    From:    Al Bok <al@phlabs.ph.com>
    To:      mh-users@ics.uci.edu
    cc:      ehuser@quack.phlabs.ph.com, aguru@mt.top.ph.com
    Subject: Query about "repl -query"

    I have a query about repl -query...

    Actually, this switch may already be in the message, just not
            ...
    Thanks, all of you.   --Al Bok

    ------- Message 2

    Date:    Tue, 10 Jan 1995 17:06:04 -0500
    From:    "Terry Y. Kritel" <tykritel@bigsun.ncs.syr.edu>
    To:      ehuser@animals.ncs.syr.edu (Emma H. User)
    Subject: Re: Fast Find

    Emma,

    We never did get the fast find working in the NFS environment.
            ...
    Terry

    ------- Message 3

    Date:    Wed, 11 Jan 1995 11:24:45 -0500
    From:    "Terry Y. Kritel" <tykritel@bigsun.ncs.syr.edu>
    To:      ehuser@animals.ncs.syr.edu (Emma H. User)
    Subject: Re: Mail problems... plus copy of my original question

    Emma,

    That's happened before.  There's a problem with the name server,
    and the request times out.  We're checking into it.

    ------- End of Forwarded Messages

    That's all for now, Dave.

    % burst -verbose
    4 messages exploded from digest 1
    message 4 of digest 1 becomes message 4
    message 3 of digest 1 becomes message 3
    message 2 of digest 1 becomes message 2
    % scan
       1  01/13 To:daved           Mail questions I told you about
       2+ 01/09 Al Bok             Query about "repl -query"<<I ha
       3  01/10 "Terry Y. Kritel"  Re: Fast Find<<Emma, We never d
       4  01/11 "Terry Y. Kritel"  Re: Mail problems... plus copy
    
If the digest is part of a sequence, the burst messages will be added to the same sequence. This is undocumented, so it might change -- but it's been true for as long as I can remember.

If you don't want to destroy the digest, you can link it into another folder (or the current folder) and use burst -inplace. For instance, when I want to extract one message from a digest, I link the digest into my "temporary" folder named DELETE, extract the message, and refile it:

    % refile -link +DELETE
    % burst -noinplace last +DELETE
    % scan cur-last
      47+ 01/09 Al Bok             Query about "repl -query"<<I ha
      48  01/10 "Terry Y. Kritel"  Re: Fast Find<<Emma, We never d
      49  01/11 "Terry Y. Kritel"  Re: Mail problems... plus copy
    % refile 49 +syserrs
    
If you do those steps often, a shell function or alias could combine the three commands into one. Be sure to use the && shell operator between the commands. The Section Using Shell Aliases and Functions with MH explains.
NOTE: The burst command doesn't always work. The message format is important; not all digests have the same format. burst also can't handle MH messages forwarded with forw -nodashstuffing.

Once you experiment and find a consistent setup, you'll probably have little trouble. The -noinplace switch is safest. See your online burst(1) manual page for more information.

Here's an unusual and interesting way to use burst. When you get a message that was returned as undeliverable, you may be able to use burst to extract the original message from the error mail. It may or may not work on your system, depending on how returned mail messages are formatted. Briefly, here are the steps:

% show
...Returned message appears...
% burst
...Extracts original message, if format is right...
% comp -use -draftfolder @. -draftmessage next
...Original message appears as a draft; the @. means "the current folder"...

What now? send

Again, whether that works will depend on whether the returned message is in a burst-able format. Newer versions of sendmail use MIME multipart format for bounces; you can extract the original with mhn -store or mhstore. The resend program is more general and easier to use for resending bounced messages. Still, this example shows where an encapsulation standard and burst can be useful.