summaryrefslogtreecommitdiff
path: root/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py
diff options
context:
space:
mode:
authorMantavya Gajjar <mga@tinyerp.com>2007-04-02 10:14:28 +0000
committerMantavya Gajjar <mga@tinyerp.com>2007-04-02 10:14:28 +0000
commit39e74f492f08ba3396401c8fcbef2a3a6030d3d8 (patch)
tree7d88899e8d72d68da925572ebd794a8dd227a212 /addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py
parent257da7d41e906ec5166a2978af311e73da26abf8 (diff)
seprate attachment from mail
bzr revid: mga@tinyerp.com-e2964d02a5340c4ffebb002364b8cbfd7a41c480
Diffstat (limited to 'addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py')
-rwxr-xr-xaddons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py b/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py
index 0c209dd72f6..96cda8b4603 100755
--- a/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py
+++ b/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py
@@ -90,13 +90,16 @@ class email_parser(object):
body = ''
if msg.is_multipart():
for part in msg.get_payload():
- if(part.get_content_maintype()=='application'):
+ if part.get_content_maintype()=='application' or part.get_content_maintype()=='image':
filename = part.get_filename();
- #fp = open(os.path.join('/home/admin/Desktop/', filename), 'wb')
- fp.write(part.get_payload(decode=1))
- #fp.close()
- elif (part.get_content_maintype()=='text') and (part.get_content_subtype()=='plain'):
- body += part.get_payload(decode=1).decode(part.get_charsets()[0])
+# #fp = open(os.path.join('/home/admin/test-src/', filename), 'wb')
+# #fp.write(part.get_payload(decode=1))
+# #fp.close()
+
+ #TODO : make any array of the attachment and return back to called function so that
+ # from that function we can store it in to Tiny
+ elif(part.get_content_maintype()=='text') and (part.get_content_subtype()=='plain'):
+ body += part.get_payload(decode=1); #.decode(part.get_charsets()[0])
#end if
#end for
else: