forked from mirror/django-mailbox
python3 support for rfc822.parseaddr (#95)
This commit is contained in:
parent
8a73076427
commit
7198404efd
1 changed files with 5 additions and 2 deletions
|
|
@ -1,7 +1,10 @@
|
||||||
import email
|
import email
|
||||||
import logging
|
import logging
|
||||||
import rfc822
|
|
||||||
import sys
|
import sys
|
||||||
|
try:
|
||||||
|
from email import utils
|
||||||
|
except ImportError:
|
||||||
|
import rfc822 as utils
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
|
@ -38,5 +41,5 @@ class Command(BaseCommand):
|
||||||
return mailbox
|
return mailbox
|
||||||
|
|
||||||
def get_mailbox_for_message(self, message):
|
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)
|
return self.get_mailbox_by_name(email_address)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue