#!/usr/bin/python import getpass, imaplib, string from StringIO import StringIO # # getBody - strips of the header from an email message # Only the body of the message is returned. # def getBody(message): body="" seenStart = 0 for line in StringIO(message).readlines(): l = string.strip(line) if (seenStart == 1): body = body + "\n" + l elif l == "": seenStart = 1 return body # # getField - returns the field value "field" in the header # section of the message # def getField(message, field): for line in StringIO(message).readlines(): l = string.strip(line) if (string.find(l, field) != -1): words = string.split(l, field) return words[1] return "unknown" # # containsTag - returns TRUE if an html tag <'t' is found # def containsTag(l, t): return ((string.find(l, "<" + t) != -1) or (string.find(l, "