views:

432

answers:

4

I would like to know if there is any easy way to print multiple emails(about 200) so that they continue on as opposed to printing one per page. I have tried with thunderbird and evolution and this does not seem possible. Would concatenating the individual mail files work or are there other unix utilities that could do this? WOuld sed or awk be suited for this?

+3  A: 

Why don't you put all the data from the mails in one text file and print that one.

This could be done by something like:

cat *.eml > file.txt

Or print it directly with

cat *.eml | lpr
boutta
Yes, it is that simple.
Svante
But that will print it with the headers and full information
Joshxtothe4
Exactly. You'd need to filter the lines you don't want for not displaying these.
boutta
+1  A: 

I can say for sure about *n*x, but if it is possible to define a printer which only outputs text, and that will output to a text file, then you could print your batch to that printer and remove the form-feeds from the resulting text file.

I've used a similar technique in Windows: create a new printer using the Generic / Text-Only driver, and specify that output is to a text file. Then print whatever, give the location of the output file to the print dialog and then clean up the result when the printing is done.

boost
You are thinking in Windows terms, which is lacking all basic utilities. In Unix, if you want to concatenate something before you send it to a printer, you use a util to concatenate it (cat), and then send it to the printer (lpr).
Svante
I want to print it without the headers and such however.
Joshxtothe4
+1  A: 

If you're wanting to filter emails then I suggest finding where the data is stored and scripting a solution at that level.

On my Windows box, Thunderbird stores my Inbox in a rather large-ish file at

C:\Documents and Settings\Bruce Axtens\Application Data\Thunderbird\Profiles\x5j9chtd.default\Mail\Local Folders\Inbox

I don't know where *n*x stores yours: perhaps in a hidden folder in your root directory. E.g.

/home/josh/.thunderbird

Parsing raw email data is not for the faint hearted (though Wikipedia has a good article on email which would get you started in the right direction.)

For the rest of us (me included), there are lots of scripting resources to do the hack work for you, while you craft your solution. If found this as a good place to start for Perl. Others may be able to suggest libraries for other languages.

boost
+2  A: 
shank
Your open command looks like it is missing a close quote somewhere. Where are $email and $message defined? Why do you re-open the DATA filehandle without a __DATA__ block?
Hudson
shank