mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-10 06:48:19 +02:00
changes main directory to mailbox2
This commit is contained in:
parent
010611dc55
commit
5177ea5c65
83 changed files with 4 additions and 53025 deletions
23
django_mailbox2/management/commands/getmail.py
Normal file
23
django_mailbox2/management/commands/getmail.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import logging
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from django_mailbox.models import Mailbox
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
mailboxes = Mailbox.active_mailboxes.all()
|
||||
if args:
|
||||
mailboxes = mailboxes.filter(name=" ".join(args))
|
||||
for mailbox in mailboxes:
|
||||
logger.info("Gathering messages for %s", mailbox.name)
|
||||
messages = mailbox.get_new_mail()
|
||||
for message in messages:
|
||||
logger.info(
|
||||
"Received %s (from %s)", message.subject, message.from_address
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue