aboutsummaryrefslogtreecommitdiffstats
path: root/servo
diff options
context:
space:
mode:
Diffstat (limited to 'servo')
-rw-r--r--servo/management/commands/checkmail.py26
1 files changed, 2 insertions, 24 deletions
diff --git a/servo/management/commands/checkmail.py b/servo/management/commands/checkmail.py
index 07d5727..6a20f2f 100644
--- a/servo/management/commands/checkmail.py
+++ b/servo/management/commands/checkmail.py
@@ -1,34 +1,12 @@
# -*- coding: utf-8 -*-
-import logging
-from email.parser import Parser
-
from django.core.management.base import BaseCommand
-from servo.models import Configuration, Note, User
+from servo.tasks import check_mail
class Command(BaseCommand):
help = "Checks IMAP box for new mail"
def handle(self, *args, **options):
- uid = Configuration.conf('imap_act')
-
- if uid == '':
- raise ValueError('Incoming message user not configured')
-
- user = User.objects.get(pk=uid)
- server = Configuration.get_imap_server()
- typ, data = server.search(None, "UnSeen")
-
- for num in data[0].split():
- #logging.debug("** Processing message %s" % num)
- typ, data = server.fetch(num, "(RFC822)")
- # parsestr() seems to return an email.message?
- msg = Parser().parsestr(data[0][1])
- Note.from_email(msg, user)
- #server.copy(num, 'servo')
- server.store(num, '+FLAGS', '\\Seen')
-
- server.close()
- server.logout()
+ check_mail()