1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

python3 support for rfc822.parseaddr (#95)

This commit is contained in:
Steeve 2016-05-15 21:08:27 +02:00 committed by Adam Coddington
parent 8a73076427
commit 7198404efd

View file

@ -1,7 +1,10 @@
import email
import logging
import rfc822
import sys
try:
from email import utils
except ImportError:
import rfc822 as utils
from django.core.management.base import BaseCommand
@ -38,5 +41,5 @@ class Command(BaseCommand):
return mailbox
def get_mailbox_for_message(self, message):
email_address = rfc822.parseaddr(message['to'])[1][0:255]
email_address = utils.parseaddr(message['to'])[1][0:255]
return self.get_mailbox_by_name(email_address)