simple script to read and output Mailbox body to file.

fishboy fishboy at spamspamspam.com
Tue Jun 8 05:18:01 EDT 2004


On Tue, 08 Jun 2004 09:49:41 +0100, Chuck Amadi <chuck at smtl.co.uk>
wrote:

>I have tried  breaking it down a bit as per your post.
>when I run it I still dont see any results even to my output file .
>Im logged in as myself ansd trying to access the mailbox on the mailserver 
>which is mounted via nfs.The mail server has only version Python 1.5 So doesnt 
>know about the email module.
>
>Cheers
>
>output =('/tmp/SurveyResults','w')
>
>fp = open("/var/spool/mail/chuck")
>
>
>mbox = mailbox.UnixMailbox(fp)
>for mail in mbox:
>	print mail.read()
>	break #just look at one message
>
>

What does a
$less /var/spool/mail/chuck
give you?

UnixMailbox is expecting a single file with all the emails
concatenated in it.  UnixMailbox just splits them out one at a time.

Hrmmm, looking in the source, it recommends that you use
PortableUnixMailbox instead.  If you can see the emails with the
'less' command, maybe that will work.

If you don't see any emails with 'less', I'm left wondering where your
emails are at?

><{{{*>




More information about the Python-list mailing list