Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > a python script which will parse an email message

Reply
Thread Tools

a python script which will parse an email message

 
 
Chuck Amadi
Guest
Posts: n/a
 
      05-28-2004

Hi Skip and all .

I have downloaded the module (mboxutils.py) from Spambayes project's mboxutils
module:

Thus created my script mailbox.py

Had a look at especially the getmbox() function.
And tried to use as So .

#!/usr/bin/env python


#Import statement used to import external modules
import mboxutils
#Existing file a Unix-style mailbox
for msg in mboxutils.getmbox("/var/spool/mail/chucka"):
print msg['subject']
print msg['body']


I need just the Subject and Body of the all mail messages in the above Mail
folder
Runs but no output So I know its' done something as when I use another user
mailbox
it produces an error permission denied . So basically how do I see the output
result and thus I can process it to One File.

Im digesting the mboxutils.py but I assume that as an external module I just
load it using the import statement as above

Cheers

Chuck



 
Reply With Quote
 
 
 
 
William Park
Guest
Posts: n/a
 
      05-28-2004
Chuck Amadi <(E-Mail Removed)> wrote:
> for msg in mboxutils.getmbox("/var/spool/mail/chucka"):
> print msg['subject']
> print msg['body']
>
> I need just the Subject and Body of the all mail messages in the above Mail
> folder


Assuming it's not homework,
formail -X From: -X Subject: -s < /var/spool/mail/chucka

--
William Park, Open Geometry Consulting, <(E-Mail Removed)>
Linux, Bash, Vim, TeX/LaTeX, Python, Mozilla, OpenOffice, Thin-Client
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: a python script which will parse an email message chuck amadi Python 0 05-31-2004 10:48 PM
a python script which will parse an email message chuck amadi Python 0 05-31-2004 03:24 PM
a python script which will parse an email message chuck amadi Python 0 05-28-2004 06:47 AM
a python script which will parse an email message chuck amadi Python 0 05-28-2004 06:43 AM
a python script which will parse an email message chuck amadi Python 1 05-28-2004 03:28 AM



Advertisments