2008-02-06 05:36:07 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
"""
|
|
|
|
Jutda Helpdesk - A Django powered ticket tracker for small enterprise.
|
2008-01-15 06:18:54 +01:00
|
|
|
|
2008-02-06 05:36:07 +01:00
|
|
|
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
|
2008-01-15 06:18:54 +01:00
|
|
|
|
2008-02-06 05:36:07 +01:00
|
|
|
scripts/get_email.py - Designed to be run from cron, this script checks the
|
2016-09-15 02:35:18 +02:00
|
|
|
POP and IMAP boxes, or a local mailbox directory,
|
|
|
|
defined for the queues within a
|
2008-08-19 10:50:38 +02:00
|
|
|
helpdesk, creating tickets from the new messages (or
|
2008-02-06 05:36:07 +01:00
|
|
|
adding to existing tickets if needed)
|
2008-01-15 06:18:54 +01:00
|
|
|
"""
|
2008-08-18 23:29:31 +02:00
|
|
|
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
|
|
|
|
2008-08-18 23:29:31 +02:00
|
|
|
class Command(BaseCommand):
|
2016-10-23 22:09:17 +02:00
|
|
|
|
2009-07-21 11:54:23 +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.'
|
2016-09-15 02:35:18 +02:00
|
|
|
|
|
|
|
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',
|
|
|
|
)
|
2023-10-24 14:49:56 +02:00
|
|
|
parser.add_argument(
|
|
|
|
'--debug_to_stdout',
|
|
|
|
action='store_true',
|
|
|
|
dest='debug_to_stdout',
|
|
|
|
default=False,
|
|
|
|
help='Log additional messaging to stdout.',
|
|
|
|
)
|
2009-07-21 11:54:23 +02:00
|
|
|
|
2008-08-18 23:29:31 +02:00
|
|
|
def handle(self, *args, **options):
|
2009-07-21 11:54:23 +02:00
|
|
|
quiet = options.get('quiet', False)
|
2023-10-24 14:49:56 +02:00
|
|
|
debug_to_stdout = options.get('debug_to_stdout', False)
|
|
|
|
process_email(quiet=quiet, debug_to_stdout=debug_to_stdout)
|
2008-08-18 23:29:31 +02:00
|
|
|
|
2008-08-19 10:50:38 +02:00
|
|
|
|
2008-01-07 21:22:13 +01:00
|
|
|
if __name__ == '__main__':
|
|
|
|
process_email()
|