mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-10 06:48:19 +02:00
Merge 8fac7c9711 into 09fbf4ea56
This commit is contained in:
commit
8c6007da23
1 changed files with 8 additions and 1 deletions
|
|
@ -162,7 +162,14 @@ class Mailbox(models.Model):
|
|||
msg.message_id = message['message-id'][0:255]
|
||||
msg.from_header = message['from']
|
||||
msg.to_header = message['to']
|
||||
msg.body = message.as_string()
|
||||
# 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:
|
||||
msg.in_reply_to = Message.objects.filter(message_id=message['in-reply-to'])[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue