Smart email parsing (closes #203): Use email-reply-parser to ignore cruft in incoming emails

This commit is contained in:
Ross Poulton 2014-01-29 23:08:33 +11:00
parent 0e58c99f69
commit 452a34ad72
3 changed files with 6 additions and 2 deletions

View File

@ -25,12 +25,13 @@ LICENSE.3RDPARTY for license terms for included packages.
Dependencies (pre-flight checklist) Dependencies (pre-flight checklist)
----------------------------------- -----------------------------------
1. Python 2.5+ 1. Python 2.6+
2. Django (1.4 or newer) 2. Django (1.4 or newer)
3. South for database migrations (highly recommended, but not required). Download from http://south.aeracode.org/ 3. South for database migrations (highly recommended, but not required). Download from http://south.aeracode.org/
4. An existing WORKING Django project with database etc. If you 4. An existing WORKING Django project with database etc. If you
cannot log into the Admin, you won't get this product working. cannot log into the Admin, you won't get this product working.
5. `pip install django-bootstrap-form` and add `bootstrapform` to `settings.INSTALLED_APPS` 5. `pip install django-bootstrap-form` and add `bootstrapform` to `settings.INSTALLED_APPS`
6. `pip install email-reply-parser` to get smart email reply handling
**NOTE REGARDING SQLITE AND SEARCHING:** **NOTE REGARDING SQLITE AND SEARCHING:**
If you use sqlite as your database, the search function will not work as If you use sqlite as your database, the search function will not work as

View File

@ -21,6 +21,8 @@ from email.header import decode_header
from email.Utils import parseaddr, collapse_rfc2231_value from email.Utils import parseaddr, collapse_rfc2231_value
from optparse import make_option from optparse import make_option
from email_reply_parser import EmailReplyParser
from django.core.files.base import ContentFile from django.core.files.base import ContentFile
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db.models import Q from django.db.models import Q
@ -192,7 +194,7 @@ def ticket_from_message(message, queue, quiet):
if part.get_content_maintype() == 'text' and name == None: if part.get_content_maintype() == 'text' and name == None:
if part.get_content_subtype() == 'plain': if part.get_content_subtype() == 'plain':
body_plain = decodeUnknown(part.get_content_charset(), part.get_payload(decode=True)) body_plain = EmailReplyParser.parse_reply(decodeUnknown(part.get_content_charset(), part.get_payload(decode=True)))
else: else:
body_html = part.get_payload(decode=True) body_html = part.get_payload(decode=True)
else: else:

View File

@ -1,2 +1,3 @@
Django>1.4 Django>1.4
django-bootstrap-form django-bootstrap-form
email-reply-parser