Commit 31056c587a32e24812c73802a98a61d46d73f085
1 parent
69772ccd
Exists in
master
and in
39 other branches
Using super archives send email util instead django emailmessage object
Showing
1 changed file
with
4 additions
and
5 deletions
Show diff stats
src/super_archives/management/commands/import_emails.py
@@ -11,7 +11,7 @@ from optparse import make_option | @@ -11,7 +11,7 @@ from optparse import make_option | ||
11 | 11 | ||
12 | from django.db import transaction | 12 | from django.db import transaction |
13 | from django.template.defaultfilters import slugify | 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 | from django.core.management.base import BaseCommand, CommandError | 15 | from django.core.management.base import BaseCommand, CommandError |
16 | from django.template.loader import render_to_string | 16 | from django.template.loader import render_to_string |
17 | from django.utils.translation import ugettext as _ | 17 | from django.utils.translation import ugettext as _ |
@@ -200,11 +200,11 @@ class Command(BaseCommand, object): | @@ -200,11 +200,11 @@ class Command(BaseCommand, object): | ||
200 | 200 | ||
201 | subject = email_msg.get_subject() | 201 | subject = email_msg.get_subject() |
202 | if not subject: | 202 | if not subject: |
203 | - no_subject_mail = EmailMessage( | 203 | + colab_send_email( |
204 | subject=_( | 204 | subject=_( |
205 | u"[Colab] Warning - Email sent with a blank subject." | 205 | u"[Colab] Warning - Email sent with a blank subject." |
206 | ), | 206 | ), |
207 | - body=render_to_string( | 207 | + message=render_to_string( |
208 | u'superarchives/emails/email_blank_subject.txt', | 208 | u'superarchives/emails/email_blank_subject.txt', |
209 | { | 209 | { |
210 | 'email_body': email_msg.get_body(), | 210 | 'email_body': email_msg.get_body(), |
@@ -212,9 +212,8 @@ class Command(BaseCommand, object): | @@ -212,9 +212,8 @@ class Command(BaseCommand, object): | ||
212 | 'user': email_addr.get_full_name() | 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 | email = Message.all_objects.create( | 218 | email = Message.all_objects.create( |
220 | message_id=email_msg.get('Message-ID'), | 219 | message_id=email_msg.get('Message-ID'), |