mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-29 03:13:15 +01:00
PY3 get_email support in method ticket_from_message (if message isinstance bytes use email.email_from_bytes(msg) else ..from_string(msg))
This commit is contained in:
parent
431d1fa3a5
commit
4c97ecd0ae
@ -274,7 +274,13 @@ def ticket_from_message(message, queue, logger):
|
|||||||
if six.PY2:
|
if six.PY2:
|
||||||
message = email.message_from_string(msg)
|
message = email.message_from_string(msg)
|
||||||
elif six.PY3:
|
elif six.PY3:
|
||||||
message = email.message_from_bytes(msg)
|
print(type(msg))
|
||||||
|
print(msg)
|
||||||
|
print(isinstance(msg, bytes))
|
||||||
|
if isinstance(msg, bytes):
|
||||||
|
message = email.message_from_bytes(msg)
|
||||||
|
else:
|
||||||
|
message = email.message_from_string(msg)
|
||||||
subject = message.get('subject', _('Created from e-mail'))
|
subject = message.get('subject', _('Created from e-mail'))
|
||||||
subject = decode_mail_headers(decodeUnknown(message.get_charset(), subject))
|
subject = decode_mail_headers(decodeUnknown(message.get_charset(), subject))
|
||||||
for affix in STRIPPED_SUBJECT_STRINGS:
|
for affix in STRIPPED_SUBJECT_STRINGS:
|
||||||
|
Loading…
Reference in New Issue
Block a user