raise NotmuchError
next_indent = indent + 1
-
+ # get replies and print them also out (if there are any)
replies = msg.get_replies()
- # if isinstance(replies, types.NoneType):
- # break
if not replies is None:
sys.stdout.write(set_sep)
replies.print_messages(format, next_indent, entire_thread)
email_msg = email.message_from_file(fp)
fp.close()
- # A subfunction to recursively unpack the message parts into a
- # list.
- # def msg_unpacker_gen(msg):
- # if not msg.is_multipart():
- # yield msg
- # else:
- # for part in msg.get_payload():
- # for subpart in msg_unpacker_gen(part):
- # yield subpart
- #
- # return list(msg_unpacker_gen(email_msg))
out = []
for msg in email_msg.walk():
if not msg.is_multipart():
return out
def get_part(self, num):
+ """Returns the nth message body part"""
parts = self.get_message_parts()
if (num <= 0 or num > len(parts)):
return ""
output += "\n\fheader{"
#Todo: this date is supposed to be prettified, as in the index.
- output += "\n%s (%s) (" % (format["headers"]["from"],
- format["headers"]["date"])
+ output += "\n%s (%s) (" % (format["headers"]["From"],
+ format["headers"]["Date"])
output += ", ".join(format["tags"])
output += ")"
- output += "\nSubject: %s" % format["headers"]["subject"]
- output += "\nFrom: %s" % format["headers"]["from"]
- output += "\nTo: %s" % format["headers"]["to"]
- if format["headers"]["cc"]:
- output += "\nCc: %s" % format["headers"]["cc"]
- if format["headers"]["bcc"]:
- output += "\nBcc: %s" % format["headers"]["bcc"]
- output += "\nDate: %s" % format["headers"]["date"]
+ output += "\nSubject: %s" % format["headers"]["Subject"]
+ output += "\nFrom: %s" % format["headers"]["From"]
+ output += "\nTo: %s" % format["headers"]["To"]
+ if format["headers"]["Cc"]:
+ output += "\nCc: %s" % format["headers"]["Cc"]
+ if format["headers"]["Bcc"]:
+ output += "\nBcc: %s" % format["headers"]["Bcc"]
+ output += "\nDate: %s" % format["headers"]["Date"]
output += "\n\fheader}"
output += "\n\fbody{"
if not p.has_key("filename"):
output += "\n\fpart{ "
output += "ID: %d, Content-type: %s\n" % (p["id"],
- p["content_type"])
+ p["content-type"])
if p.has_key("content"):
output += "\n%s\n" % p["content"]
else:
- output += "Non-text part: %s\n" % p["content_type"]
+ output += "Non-text part: %s\n" % p["content-type"]
output += "\n\fpart}"
else:
output += "\n\fattachment{ "
output += "ID: %d, Content-type:%s\n" % (p["id"],
- p["content_type"])
+ p["content-type"])
output += "Attachment: %s\n" % p["filename"]
output += "\n\fattachment}\n"