CRM: fix mailgate script to be more fault tolerant
bzr revid: ced-5844af190afda33037416682852e2b58f3d1e5c5
This commit is contained in:
parent
8bf26e5d80
commit
d6b042ec88
|
@ -1,5 +0,0 @@
|
|||
test:
|
||||
fetchmail -f ./fetchmailrc -v -k
|
||||
|
||||
test_sm:
|
||||
/usr/lib/sendmail fp@tiny.be <mail.txt
|
|
@ -1,5 +0,0 @@
|
|||
# .fetchmailrc
|
||||
|
||||
poll pop.tiny.be proto pop3:
|
||||
username testcli@tiny.be password tiny mda "/home/pinky/code/terp/trunk/server/bin/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py -u3 -padmin -ssupport -etestcli@tiny.be -mfp@tiny.be -dterp"
|
||||
|
|
@ -127,7 +127,9 @@ class email_parser(object):
|
|||
continue
|
||||
|
||||
if part.get_content_maintype()=='text' and part.get_content_subtype() == 'plain':
|
||||
message['body'] += part.get_payload(decode=True).decode(part.get_charsets()[0])
|
||||
buf = part.get_payload(decode=True)
|
||||
if buf:
|
||||
message['body'] += buf.decode(part.get_charsets()[0] or 'ascii', 'replace')
|
||||
elif part.get_content_maintype()=='application' or part.get_content_maintype()=='image' or part.get_content_maintype()=='text':
|
||||
filename = part.get_filename();
|
||||
if filename :
|
||||
|
|
Loading…
Reference in New Issue