diff --git a/docbow_project/docbow/management/commands/sendmail.py b/docbow_project/docbow/management/commands/sendmail.py index 40b8a6c..8f832de 100644 --- a/docbow_project/docbow/management/commands/sendmail.py +++ b/docbow_project/docbow/management/commands/sendmail.py @@ -63,13 +63,12 @@ In case of failure the following return value is returned: if exit_code: sys.exit(exit_code) - def handle_mail(self, mail, mail_sender, mail_recipients, **options): content_errors = [] attachments = [] recipients = [] description = u'' - mail_from = mail.get('From') + mail_from = email.utils.parseaddr(mail.get('From'))[1] tos = mail.get_all('to', []) ccs = mail.get_all('cc', []) resent_tos = mail.get_all('resent-to', []) @@ -118,7 +117,7 @@ In case of failure the following return value is returned: try: sender = mail_sender or auth_models.User.objects.get(email=mail_from) except auth_models.User.DoesNotExist: - content_errors.appen('Unable to find an unique sender for the mail %s' % mail_from) + content_errors.append('Unable to find an unique sender for the mail %s' % mail.get('From')) if content_errors: msg = [ '7.7.1 The email sent contains many errors:' ] for error in content_errors: