22# -*- coding: utf-8 -*-
33from __future__ import unicode_literals , print_function
44
5- import datetime
6- import email
75import flufl .bounce
86import mailbox
9- import re
10- import time
7+ import sys
118
129from tqdm import tqdm
1310
14- from django .conf import settings
1511from django .core .exceptions import ValidationError
16- from django .core .management .base import BaseCommand , CommandError
12+ from django .core .management .base import BaseCommand
1713from django .core .validators import validate_email
1814
1915import debug # pyflakes:ignore
@@ -26,8 +22,7 @@ class Command(BaseCommand):
2622 Deactivate bouncing email addresses.
2723
2824 Take one or more email addresses to deactivate from the command line,
29- or read delivery-status emails from an mbox file and extract addresses
30- with delivery failures from that, and mark them inactive.
25+ or read delivery-status emails from an mbox file and extract addresses with delivery failures from that, and mark them inactive.
3126
3227 """ )
3328
@@ -87,7 +82,7 @@ def handle(self, *args, **options):
8782 email .active = False
8883 email .origin = email .person .user .username if email .person .user_id else ('script: %s deactivation' % options ['reason' ])
8984 email .save ()
90- event = PersonEvent .objects .create (person = email .person , type = 'email_address_deactivated' ,
85+ PersonEvent .objects .create (person = email .person , type = 'email_address_deactivated' ,
9186 desc = "Deactivated the email addres <%s>. Reason: %s" % (email .address , options ['reason' ]) )
9287 else :
9388 if email is None :
0 commit comments