2014-08-22 20:02:58 -07:00
|
|
|
import logging
|
|
|
|
|
|
2012-06-27 20:45:01 -07:00
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
|
|
|
|
|
|
from django_mailbox.models import Mailbox
|
|
|
|
|
|
2014-08-22 20:02:58 -07:00
|
|
|
|
2012-06-27 20:45:01 -07:00
|
|
|
class Command(BaseCommand):
|
2023-05-18 10:24:43 +06:00
|
|
|
def add_arguments(self, parser):
|
|
|
|
|
parser.add_argument('-mb', '--mailboxes', type=str, nargs='+', help='Write mailbox names')
|
|
|
|
|
parser.add_argument('-mr', '--max_read', type=int,
|
|
|
|
|
help='Write maximum number of email to read from each mailbox')
|
|
|
|
|
|
2012-06-27 20:45:01 -07:00
|
|
|
def handle(self, *args, **options):
|
2023-01-24 06:08:47 -08:00
|
|
|
logging.basicConfig(level=logging.INFO)
|
2023-05-18 10:24:43 +06:00
|
|
|
Mailbox.get_new_mail_all_mailboxes(options)
|