[comp.mail.mush] forwarding many messages

hirchert@ux1.cso.uiuc.edu (Kurt Hirchert) (07/23/90)

The answer to this one may be in the manual, but I haven't found it, so I
will prevail upon your collective wisdom:

From time to time, I get requests to forward copies of messages I have
received.  The number of messages involved is sometimes quite large.  My
usual approach is to use one or more pick commands to identify the messages
I wish to forward and pipe that into mail -f.  The problem with this approach
is that after the first few messages, the attempts to forward these messages
fail because of insufficient memory.  Apparently, each forwarded message is
initiated with a separate invocation of sendmail (?), and the machine runs out
of memory when I try to send too many at a time.  Is there a way I can either
get mush to wait for the earlier messages to quit before trying to send more
or a way I can conveniently break the list of messages into shorter lists that
I can manually space out?

Please note that I do not do the mush maintenance around here, so options in
the source do me no good.

Note also that the disk space occupied by the list of messages is sufficiently
large that I prefer not to save a second copy of all the messages in a scratch
mail folder in order to break up the forwarding that way.

Thank you for consideration.
-- 
Kurt W. Hirchert     hirchert@ncsa.uiuc.edu
National Center for Supercomputing Applications

schaefer@CSE.OGI.EDU (Barton E. Schaefer) (07/23/90)

On Jul 22,  7:14pm, Kurt Hirchert wrote:
} Subject: forwarding many messages
}
} From time to time, I get requests to forward copies of messages I have
} received.  [...]  The problem with [piping lots of messages to mail -f]
} is that after the first few messages, the attempts to forward these messages
} fail because of insufficient memory.  [...]  Is there a way I can either
} get mush to wait for the earlier messages to quit before trying to send more
} or a way I can conveniently break the list of messages into shorter lists that
} I can manually space out?

If you use "mail -v -f" or "set verbose", mush will fork the sendmails
one at a time so that you can see the verbosity.  This should work for
most installations. However, if your MTA does not support any verbose
options, mush may have been installed with the "-v" switch disabled.  In
this case, there isn't any way to force one-sendmail-at-a-time.

To split lists of messages into shorter lists, there are options of the
"pick" command that perform head or tail operations.  First, generate the
list you want:

    pick -s "Please forward" | set forward

Next, pick out the first three (or whatever number is best) and pipe
to mail:

    $forward | pick +3 | set sent | mail -f

Now remove the sent messages from $forward:

    $forward { $sent } | set forward

Repeat the last two steps as necessary.  You can make cmd aliases to
speed this up; perhaps:

    cmd fset   'pick \!* | set forward ; echo "Forward: $forward"'
    cmd fsplit '$forward | pick +3 | set sent | mail -f ;\
		$forward { $sent } | set forward ;\
		echo "Sent: $sent -- Remaining: $forward"'

Now you can type "fset", then "fsplit", and then repeat "!!" (history
reference) until all the messages are sent.  Warning: if you use fsplit
without first setting $forward, you'll forward the current message.

-- 
Bart Schaefer						schaefer@cse.ogi.edu