Commit 31056c587a32e24812c73802a98a61d46d73f085

Authored by Luan
1 parent 69772ccd

Using super archives send email util instead django emailmessage object

src/super_archives/management/commands/import_emails.py
... ... @@ -11,7 +11,7 @@ from optparse import make_option
11 11  
12 12 from django.db import transaction
13 13 from django.template.defaultfilters import slugify
14   -from django.core.mail.message import EmailMessage
  14 +from super_archives.utils.message import colab_send_email
15 15 from django.core.management.base import BaseCommand, CommandError
16 16 from django.template.loader import render_to_string
17 17 from django.utils.translation import ugettext as _
... ... @@ -200,11 +200,11 @@ class Command(BaseCommand, object):
200 200  
201 201 subject = email_msg.get_subject()
202 202 if not subject:
203   - no_subject_mail = EmailMessage(
  203 + colab_send_email(
204 204 subject=_(
205 205 u"[Colab] Warning - Email sent with a blank subject."
206 206 ),
207   - body=render_to_string(
  207 + message=render_to_string(
208 208 u'superarchives/emails/email_blank_subject.txt',
209 209 {
210 210 'email_body': email_msg.get_body(),
... ... @@ -212,9 +212,8 @@ class Command(BaseCommand, object):
212 212 'user': email_addr.get_full_name()
213 213 }
214 214 ),
215   - to=[email_addr.address, ]
  215 + to=email_addr.address
216 216 )
217   - no_subject_mail.send()
218 217  
219 218 email = Message.all_objects.create(
220 219 message_id=email_msg.get('Message-ID'),
... ...