Add option to the EmailIgnore model to allow emails from an ignored address to be deleted (previous behaviour was to keep them all, so the mailbox could potentially become quite large - and every message was downloaded again every time the mailbox was checked). Upgrade instructions provided to both add the new database field and automatically switch to the old behaviour.

This commit is contained in:
Ross Poulton
2009-01-23 10:36:41 +00:00
parent 705c32908a
commit e37609de6e
4 changed files with 45 additions and 13 deletions

View File

@ -137,7 +137,11 @@ def ticket_from_message(message, queue):
for ignore in IgnoreEmail.objects.filter(Q(queues=queue) | Q(queues__isnull=True)):
if ignore.test(sender_email):
return False
if ignore.keep_in_mailbox:
# By returning 'False' the message will be kept in the mailbox,
# and the 'True' will cause the message to be deleted.
return False
return True
regex = re.compile("^\[[A-Za-z0-9]+-\d+\]")
if regex.match(subject):