a python script which will parse an email message

Discussion in 'Python' started by Chuck Amadi, May 28, 2004.

  1. Chuck Amadi

    Chuck Amadi Guest

    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
    Chuck Amadi, May 28, 2004
    #1
    1. Advertising

  2. Chuck Amadi

    William Park Guest

    Chuck Amadi <> 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, <>
    Linux, Bash, Vim, TeX/LaTeX, Python, Mozilla, OpenOffice, Thin-Client
    William Park, May 28, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chuck amadi
    Replies:
    1
    Views:
    432
    William Park
    May 28, 2004
  2. chuck amadi
    Replies:
    0
    Views:
    296
    chuck amadi
    May 28, 2004
  3. chuck amadi
    Replies:
    0
    Views:
    328
    chuck amadi
    May 28, 2004
  4. chuck amadi
    Replies:
    0
    Views:
    303
    chuck amadi
    May 31, 2004
  5. chuck amadi
    Replies:
    0
    Views:
    422
    chuck amadi
    May 31, 2004
Loading...

Share This Page