Commit 7081b5dbb7e30e34e7df0f93c442cbb2642e30ff
Exists in
master
and in
39 other branches
Merge pull request #128 from TracyWebTech/sendmail_for_blank_subjects
send mail to user when email subject field is blank - closes #42
Showing
4 changed files
with
52 additions
and
1 deletions
Show diff stats
src/locale/pt_BR/LC_MESSAGES/django.mo
No preview for this file type
src/locale/pt_BR/LC_MESSAGES/django.po
| ... | ... | @@ -7,7 +7,7 @@ msgid "" |
| 7 | 7 | msgstr "" |
| 8 | 8 | "Project-Id-Version: PACKAGE VERSION\n" |
| 9 | 9 | "Report-Msgid-Bugs-To: \n" |
| 10 | -"POT-Creation-Date: 2013-12-05 18:14+0000\n" | |
| 10 | +"POT-Creation-Date: 2013-12-06 10:49+0000\n" | |
| 11 | 11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 12 | 12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 13 | 13 | "Language-Team: LANGUAGE <LL@li.org>\n" |
| ... | ... | @@ -754,6 +754,10 @@ msgstr "" |
| 754 | 754 | msgid "Email address verified!" |
| 755 | 755 | msgstr "Endereço de e-mail verificado!" |
| 756 | 756 | |
| 757 | +#: super_archives/management/commands/import_emails.py:205 | |
| 758 | +msgid "[Colab] Warning - Email sent with a blank subject." | |
| 759 | +msgstr "" | |
| 760 | + | |
| 757 | 761 | #: super_archives/templates/message-preview.html:42 |
| 758 | 762 | #: super_archives/templates/message-preview.html:62 |
| 759 | 763 | msgid "by" |
| ... | ... | @@ -832,6 +836,24 @@ msgstr "mais..." |
| 832 | 836 | msgid "most relevant" |
| 833 | 837 | msgstr "mais relevantes" |
| 834 | 838 | |
| 839 | +#: super_archives/templates/superarchives/emails/email_blank_subject.txt:2 | |
| 840 | +msgid "Hello" | |
| 841 | +msgstr "" | |
| 842 | + | |
| 843 | +#: super_archives/templates/superarchives/emails/email_blank_subject.txt:3 | |
| 844 | +#, python-format | |
| 845 | +msgid "" | |
| 846 | +"\n" | |
| 847 | +"You've sent an email to %(mailinglist)s with a blank subject and the " | |
| 848 | +"following content:\n" | |
| 849 | +"\n" | |
| 850 | +"\"%(body)s\"\n" | |
| 851 | +"\n" | |
| 852 | +"Please, fill the subject in every email you send it.\n" | |
| 853 | +"\n" | |
| 854 | +"Thank you.\n" | |
| 855 | +msgstr "" | |
| 856 | + | |
| 835 | 857 | #: super_archives/templates/superarchives/emails/email_verification.txt:2 |
| 836 | 858 | #, python-format |
| 837 | 859 | msgid "" | ... | ... |
src/super_archives/management/commands/import_emails.py
| ... | ... | @@ -11,7 +11,10 @@ from optparse import make_option |
| 11 | 11 | |
| 12 | 12 | from django.db import transaction |
| 13 | 13 | from django.template.defaultfilters import slugify |
| 14 | +from super_archives.utils.message import colab_send_email | |
| 14 | 15 | from django.core.management.base import BaseCommand, CommandError |
| 16 | +from django.template.loader import render_to_string | |
| 17 | +from django.utils.translation import ugettext as _ | |
| 15 | 18 | |
| 16 | 19 | from super_archives.models import MailingList, Message, \ |
| 17 | 20 | Thread, EmailAddress |
| ... | ... | @@ -196,6 +199,21 @@ class Command(BaseCommand, object): |
| 196 | 199 | email_addr.save() |
| 197 | 200 | |
| 198 | 201 | subject = email_msg.get_subject() |
| 202 | + if not subject: | |
| 203 | + colab_send_email( | |
| 204 | + subject=_( | |
| 205 | + u"[Colab] Warning - Email sent with a blank subject." | |
| 206 | + ), | |
| 207 | + message=render_to_string( | |
| 208 | + u'superarchives/emails/email_blank_subject.txt', | |
| 209 | + { | |
| 210 | + 'email_body': email_msg.get_body(), | |
| 211 | + 'mailinglist': mailinglist.name, | |
| 212 | + 'user': email_addr.get_full_name() | |
| 213 | + } | |
| 214 | + ), | |
| 215 | + to=email_addr.address | |
| 216 | + ) | |
| 199 | 217 | |
| 200 | 218 | email = Message.all_objects.create( |
| 201 | 219 | message_id=email_msg.get('Message-ID'), | ... | ... |
src/super_archives/templates/superarchives/emails/email_blank_subject.txt
0 → 100644
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +{% load i18n %} | |
| 2 | +{% trans 'Hello' %} {{ user }}, | |
| 3 | +{% blocktrans with body=email_body mailinglist=mailinglist %} | |
| 4 | +You've sent an email to {{ mailinglist }} with a blank subject and the following content: | |
| 5 | + | |
| 6 | +"{{ body }}" | |
| 7 | + | |
| 8 | +Please, fill the subject in every email you send it. | |
| 9 | + | |
| 10 | +Thank you. | |
| 11 | +{% endblocktrans %} | ... | ... |