convert all message in to the text message

html->text

bzr revid: mga@tinyerp.com-20090324134624-6iw3hymesqvlkmi8
This commit is contained in:
Mantavya Gajjar
2009-03-24 19:16:24 +05:30
parent b1ae71ce0f
commit 086f14d9bf
@@ -141,7 +141,9 @@ class email_parser(object):
message['attachment'] = {};
attachment = message['attachment'];
counter = 1;
def replace(match):
return ''
for part in msg.walk():
if part.get_content_maintype() == 'multipart':
continue
@@ -149,7 +151,10 @@ class email_parser(object):
if part.get_content_maintype()=='text' and part.get_content_subtype() == 'plain':
buf = part.get_payload(decode=True)
if buf:
message['body'] += buf.decode(part.get_charsets()[0] or 'ascii', 'replace')
txt = buf.decode(part.get_charsets()[0] or 'ascii', 'replace')
txt = re.sub("<(\w)>", replace, txt)
txt = re.sub("<\/(\w)>", replace, txt)
message['body'] += txt
elif part.get_content_maintype()=='application' or part.get_content_maintype()=='image' or part.get_content_maintype()=='text':
filename = part.get_filename();
if filename :