dataio
parent
ee94d3a6d3
commit
d74db6bde5
|
@ -61,15 +61,18 @@ class SmtpFileStore(object):
|
||||||
class MailDirStore(object):
|
class MailDirStore(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
from serpent.imap import mailbox
|
from serpent.imap import mailbox
|
||||||
|
from mailbox import MaildirMessage
|
||||||
self.mbox = mailbox
|
self.mbox = mailbox
|
||||||
|
self.mbox.MaildirMessage = MaildirMessage
|
||||||
def deliver(self, user, message):
|
def deliver(self, user, message):
|
||||||
mdir = os.path.join(conf.app_dir, conf.maildir_user_path % user)
|
mdir = os.path.join(conf.app_dir, conf.maildir_user_path % user)
|
||||||
if not os.path.exists(mdir):
|
if not os.path.exists(mdir):
|
||||||
os.makedirs(mdir)
|
os.makedirs(mdir)
|
||||||
inbox = os.path.join(mdir, 'INBOX')
|
inbox = os.path.join(mdir, 'INBOX')
|
||||||
mailbox = self.mbox.IMAPMailbox(inbox)
|
mailbox = self.mbox.ExtendedMaildir(inbox)
|
||||||
|
msg = self.mbox.MaildirMessage(message)
|
||||||
try:
|
try:
|
||||||
mailbox.addMessage(message, [IMAP_FLAGS['RECENT']])
|
mailbox.add(msg, [])
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from mailbox import Maildir
|
from mailbox import Maildir, MaildirMessage
|
||||||
import os
|
import os
|
||||||
|
|
||||||
class ExtendedMaildir(Maildir):
|
class ExtendedMaildir(Maildir):
|
||||||
|
|
Loading…
Reference in New Issue