django-helpdesk/helpdesk/management/commands/get_email.py

41 lines
1.3 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/python
"""
Jutda Helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
scripts/get_email.py - Designed to be run from cron, this script checks the
POP and IMAP boxes, or a local mailbox directory,
defined for the queues within a
helpdesk, creating tickets from the new messages (or
adding to existing tickets if needed)
"""
from django.core.management.base import BaseCommand
2018-10-24 18:20:12 +02:00
from helpdesk.email import process_email
2016-10-21 17:14:12 +02:00
2016-10-23 22:09:17 +02:00
class Command(BaseCommand):
2016-10-23 22:09:17 +02:00
def __init__(self):
BaseCommand.__init__(self)
2016-10-29 08:33:29 +02:00
help = 'Process django-helpdesk queues and process e-mails via POP3/IMAP or ' \
'from a local mailbox directory as required, feeding them into the helpdesk.'
def add_arguments(self, parser):
parser.add_argument(
'--quiet',
action='store_true',
dest='quiet',
default=False,
help='Hide details about each queue/message as they are processed',
)
def handle(self, *args, **options):
quiet = options.get('quiet', False)
process_email(quiet=quiet)
if __name__ == '__main__':
process_email()