1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00
This commit is contained in:
pcraston 2013-03-01 08:39:31 -08:00
commit 8c6007da23

View file

@ -162,6 +162,13 @@ class Mailbox(models.Model):
msg.message_id = message['message-id'][0:255]
msg.from_header = message['from']
msg.to_header = message['to']
# if message is multipart want to only store the actual message body in database (not attachments)
if message.is_multipart():
for part in message.walk():
if part.get_content_type() == 'text/plain' or part.get_content_type() == 'text/html':
msg.body = part.get_payload()
# else store the whole message in database
else:
msg.body = message.as_string()
if message['in-reply-to']:
try: