[Novalug] Extracting content of email

James Ewing Cottrell 3rd JECottrell3@Comcast.NET
Mon Feb 9 17:27:11 EST 2009


Mark's response is the most complete so far. The SED solution is the 
basic idea for text only emails. It expresses the idea that "an email 
message is a Header and a Body separated by a Blank Line".

But the FORMAIL solution may be needed, because MIME messages can be 
more complex. They can have more than one type of message (HTML, text, 
cideo, Klingon, Smell-O-Vision) encoded in the body, separated by 
"Content Separators". Still, strictly speaking, this IS the Body, so 
maybe the SED solution is really good enough, or maybe you need 
something like FORMAIL to pick out just the text part.

JIM

Mark Smith wrote:
> On Mon, Feb 09, 2009 at 01:43:20AM -0500, Charles M Howe wrote:
>> I wish to the content of an email and discard the routing information. ,
>> but maybe I worry two much. Maybe they are all ascii. I found my copy of
>> "Learning vi", the lost it again immediately. Real soon now I am going
>> to straiten it out and otherwise organize my life. 
> 
> you want to get rid of the headers?  in vi positioned at the top
> of the file type "d}" will do that.  but you'll lose all the headers.
> 
>> (1) How do I do this? I am almost certain that it can be be automated,
>> and easily could already be done by a well-known program. Couldn't it be
>> a bash script? Would writing such a script be an exercise for a CS
>> class? Is it already that, i.e. a frequently asked class questions?
> 
> there are better tools than vi for an automated session though.  according
> to "man procmailex":
> 
> 	To extract the body from a message:
> 	      formail -I ""
> 	or
> 	      sed -e '1,/^$/ d'
> 
>> (2) What text editor handles the output? vi would be preferable. What
>> other editors put out information in a format that is native to vi?
> 
> mail will have to be saved into a file before you can edit it using vi.
> 
>> (3) How can I change the size of vi text if I want to print an email
>> message (bigger and smaller; type size settable.
> 
> you wouldn't change the text size of vi in order to change the print font.
> there are some nifty programs which will print reasonably formatted email.
> try enscript for one.  your mua (mail client) will generally have decent
> printing functions.
> 
>> (4) Can I go from vi-recognize characters and OO word Processor to vi
>> text?
> 
> you'll necessarily lose information doing that.  you'll need to export as
> normal text (losing all formatting) and then re-import again.  this is most
> likely not what you want to do though.  what are you trying to accomplish?
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.0.233 / Virus Database: 270.10.19/1942 - Release Date: 02/07/09 13:39:00
> 




More information about the Novalug mailing list