C
Chuck Amadi
fp = file("/home/chuck/pythonScript/testbox")
mbox = mailbox.UnixMailbox(fp, email.message_from_file)
# list of body messages.
bodies = []
# mail is the file object
for mail in mbox:
print mail['Subject']
print mail.get_content_type()#text/plain
print mail.get_payload()
fp = file("/home/chuck/pythonScript/testbox")
mb = mailbox.UnixMailbox(fp, email.message_from_file)
mailout = file("/home/chuck/pythonScript/SurveyResults.txt","w")
#for mail in fp.readlines():
# mailout.write(mail)
## Something like this I have tried a few things cant get my head
## round it
for bodymsg in fp:
bodymsg= mail.get_payload()
bodies.append(bodymsg)
mailout.write(bodymsg)
print "testbox mailbox file copied...to SurveyResults.txt use cat to
view file."
# Now close the files
mailout.close()
mbox = mailbox.UnixMailbox(fp, email.message_from_file)
# list of body messages.
bodies = []
# mail is the file object
for mail in mbox:
print mail['Subject']
print mail.get_content_type()#text/plain
print mail.get_payload()
fp = file("/home/chuck/pythonScript/testbox")
mb = mailbox.UnixMailbox(fp, email.message_from_file)
mailout = file("/home/chuck/pythonScript/SurveyResults.txt","w")
#for mail in fp.readlines():
# mailout.write(mail)
## Something like this I have tried a few things cant get my head
## round it
for bodymsg in fp:
bodymsg= mail.get_payload()
bodies.append(bodymsg)
mailout.write(bodymsg)
print "testbox mailbox file copied...to SurveyResults.txt use cat to
view file."
# Now close the files
mailout.close()