Subject: Re: Print every message in folder, piping each through mp - HELP

From: [email-masked] (James McCarron)
Date: Fri, 1 Nov 1996 11:39:41 GMT

In article <[email-masked]>,
R. Stewart Ellis <[email-masked]> wrote:
>Pardon the crosspost, but I am in rather desperate need of being able to
>print most of the messages in a folder, but I want each separately formatted
>with the Solaris Mail Prettyprinter mp, so that each has its own To: and
>Subject: bubbles.  There are hundreds, if not thousands of messages, so
>doing it one at a time is out of the question.
>
[ ... deletia ... ]
>
>I would deeply appreciate any help someone can offer.
>
>
>-- 
>  R.Stewart(Stew) Ellis, Assoc.Prof., (Off)810-762-9765   ___________________
>  Humanities & Social Science,  GMI Eng.& Mgmt.Inst. ()  /   _____  ______
>  Flint, MI 48504    Free speech and free software!  /\ /        / /  /  / /
>  Web admin:  http://www.gmi.edu/      [email-masked]   /________/ /  /  / /

Hi:

There is a Perl program `unmbox' that will take a mailbox and split it
into individual messages (called `01', `02', `03' ...). You could feed
your mail folder to unmbox, and then run mp on each of the individual
files, sending the output of each to the printer. (*Very* handy script,
this `unmbox'!). My copy here at home does not have a net URL, but I
suspect you can find it at any CPAN site (that being the most likely
place that *I* found it).  If you can't find it, let me know, and I
shall email you my copy (it is quite short; I'd post it, but I haven't
the authors permission to do so).

Cheers!

James

-- 
<!DOCTYPE SIG [<!ELEMENT SIG - - (NAME,EMAIL,QUOTE)><!ELEMENT NAME - - 
(#PCDATA)><!ELEMENT EMAIL - - (#PCDATA)> <!ELEMENT QUOTE - - (#PCDATA)>]>
<SIG><NAME>James McCarron</NAME><EMAIL>[email-masked]</EMAIL>
<QUOTE>E Pluribus UNIX</QUOTE></SIG>

---

From: [email-masked] (Logan Shaw)
Date: Wed, 30 Oct 1996 06:57:59 GMT

In article <[email-masked]>,
R. Stewart Ellis <[email-masked]> wrote:
>Right now if I open a folder with Pine 3.95, select all the messages in the
>folder and pipe them through the command 'mp | lp', I get all the messages
>printed as one, with one To: header (bubble) and one Subject: footer
>(bubble).
>
>I have iterated through the following mp options:  -d -m.
>
>I have also tried the formail component of procmail.  I still get all the
>messages in the mbox formatted as one.

What incantation did you use with formail?

I would think you'd want to do this:

	formail -s mp > somefile < mailfolder

This would run "mp" lots of times and keep appending the output to the
file "somefile".  If mp spits Postscript out on stdout, this should be
okay, since in general you can do this

	cat 1.ps 2.ps 3.ps > all.ps
	lp all.ps

with Postscript files safely.

An alternate way of doing it is to invoke a little shell to run your
pipe command and spool zillions of separate print jobs.  Bad idea if
you have a header page for each print job.  At any rate, you could
do that like this:

	formail -s sh -c 'mp | lp' < mailfolder

A better idea would be to make the script generate a zillion files,
then print them with one big command:

	formail -s sh -c 'mp > mail.$$.ps' < mailfolder
	lp mail.*.ps

If this is the kind of thing you've already tried, you might want to
look at the "mailfolder" file.  If you have been piping messages to the
formail program straight from pine, or you've used the "export"
(instead of "save") feature to create the "mailfolder" file, you should
be aware that both pipes and exports strip all kinds of header stuff
from the mail message, most importantly the "From " line (NOT the
"From: " line).  If formail does not see "From " lines, chances are
that it's not going to see the boundaries between messages.

Personally, I recommend marking all the messages you want to print,
then doing an aggregate save of them to a new folder ("~/mailfolder"),
then doing an aggregate undelete (since the save will have caused them
to be marked for deletion).  If you want to print all the messages in a
folder, then just copy the folder, or run formail with the folder as
its standard input.

Hope this helps.  I believe that the fact that an export does not
produce the same kind of data as a save is probably one of pine's worst
violations of the principle of least astonishment.  But hey -- overall
it's a pretty good program.

  - Logan
-- 
Logan Shaw, Unix Systems Administrator
"everybody / loves to see / justice done / on somebody else" (Bruce Cockburn)

---

From: Terry Gray <[email-masked]>
Date: Sat, 2 Nov 1996 13:54:35 -0800 (PST)

> it's a pretty good program.

Interesting view.  If Export and Save used the same format, we wouldn't
have needed two different commands.  

-teg

---

From: Terry Gray <[email-masked]>
Date: Sun, 3 Nov 1996 23:08:13 -0800 (PST)

Andrej, you did a better job of expressing the point I was trying to make.
Thanks!

-teg

On Mon, 4 Nov 1996, Andrej Borsenkow wrote:

> On Sat, 2 Nov 1996, Terry Gray wrote:
> 
> > 
> At least one point: Export translates message to local conventions (I
> believe, it even translates between transport and local character sets)
> and Save leaves message intact, which is quite correct.
> 
> If you ever change it, you will hopelessly break one of them
> 
> greetings
> 
> -------------------------------------------------------------------------
> Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
> SNI ITS Moscow			Tel:   +7 (095) 252 13 88
> 
> NERV:  borsenkow.msk		E-Mail: [email-masked]
> -------------------------------------------------------------------------
> 
> 
> 
>

---

From: Andrej Borsenkow <[email-masked]>
Date: Mon, 4 Nov 1996 10:05:47 +0300 (MOW)

greetings

---

From: Logan Shaw <[email-masked]>
Date: Mon, 4 Nov 1996 00:04:14 -0800 (PST)

> have needed two different commands.  

Hehe.  And all this time I thought the essential difference was that
save marks a message to be deleted, while export doesn't.  To me, save
was analogous to Unix "mv", whereas export was analogous to Unix "cp".
I had assumed the change in format was an unintentional inconsistency.

Makes sense this way, though.

  - Logan

---

From: [email-masked] (Peter Wyzlic)
Date: 30 Oct 1996 08:08:41 GMT

On 29 Oct 1996 23:21:35 GMT, R. Stewart Ellis <[email-masked]> wrote:

>I am not sure whether I fail to understand pine APPLY commands, mp or
>formail.  I thought I had read something in the release notes of the newer
>pines that they could keep an aggregate print like this separate.
>

I have never used mp, so I have no opinion. But if you are using formail you
may do (e.g.): cat folder | formail -k -X From: -X To: -X Date: -X Subject:
-X Message-ID: -s > newfolder

Note the "-s" switch! For the rest: man formail. Perhaps it is advisable to
write a shell script which does all the tasks automagically (saving of the
original folder, filtering with formail, saving the new folder).

\bye

-- 
###########################################################################
Peter Wyzlic                                          [email-masked]
###########################################################################