summaryrefslogtreecommitdiff
path: root/alot/account.py
diff options
context:
space:
mode:
authorpazz <patricktotzke@gmail.com>2011-07-03 17:32:05 +0100
committerpazz <patricktotzke@gmail.com>2011-07-03 17:32:05 +0100
commit5f431ba9a1e8d62968da2a46f2d23430779393fc (patch)
tree2b3a1e9cb1836d06bff71fa5398f82cc06418a7e /alot/account.py
parent6c0083358201c663a1ef15d94d8f3b440d029eee (diff)
accept multiple formats for send_mailbox
Diffstat (limited to 'alot/account.py')
-rw-r--r--alot/account.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/alot/account.py b/alot/account.py
index b00cee57..021d7c05 100644
--- a/alot/account.py
+++ b/alot/account.py
@@ -18,6 +18,7 @@ Copyright (C) 2011 Patrick Totzke <patricktotzke@gmail.com>
"""
import mailbox
+from urlparse import urlparse
from send import SendmailSender
@@ -35,11 +36,19 @@ class Account:
self.signature = signature
self.sender_type = sender_type
+ self.mailbox = None
if sent_mailbox:
- #parse mailbox url
- self.mailbox = mailbox.Maildir(sent_mailbox)
- else:
- self.mailbox = sent_mailbox
+ mburl=urlparse(sent_mailbox)
+ if mburl.scheme=='mbox':
+ self.mailbox = mailbox.mbox(mburl.path)
+ elif mburl.scheme=='maildir':
+ self.mailbox = mailbox.Maildir(mburl.path)
+ elif mburl.scheme=='mh':
+ self.mailbox = mailbox.MH(mburl.path)
+ elif mburl.scheme=='babyl':
+ self.mailbox = mailbox.Babyl(mburl.path)
+ elif mburl.scheme=='mmdf':
+ self.mailbox = mailbox.MMDF(mburl.path)
if self.sender_type == 'sendmail':
self.sender = SendmailSender(sendmail_command,