|
|
|
|
@ -14,6 +14,8 @@ from datetime import timedelta |
|
|
|
|
from smtplib import SMTPRecipientsRefused |
|
|
|
|
from pymorphy2 import MorphAnalyzer |
|
|
|
|
morph = MorphAnalyzer() |
|
|
|
|
from logging import getLogger |
|
|
|
|
log = getLogger('mail') |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
from email.mime.multipart import MIMEMultipart |
|
|
|
|
@ -471,8 +473,8 @@ class Mailer(NewsLetterSender): |
|
|
|
|
announce_context = contact.get_announce_context() if self.announce else None |
|
|
|
|
if self.announce and not announce_context: |
|
|
|
|
send = False |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
log.info('Trying send to {email}'.format(email=contact.email)) |
|
|
|
|
# pass |
|
|
|
|
if send: |
|
|
|
|
message = self.build_message(contact, announce_context) |
|
|
|
|
@ -481,6 +483,8 @@ class Mailer(NewsLetterSender): |
|
|
|
|
message.as_string()) |
|
|
|
|
except (Exception, ) as e: |
|
|
|
|
exception = e |
|
|
|
|
log.info('Exception was raised while sending to {email}: {exception}'.format( |
|
|
|
|
email=contact.email, exception=exception)) |
|
|
|
|
else: |
|
|
|
|
exception = None |
|
|
|
|
self.update_ab_state() |
|
|
|
|
|