oauth_module = None
from . import response_lexer
+from . import tls
+ from .datetime_util import datetime_to_INTERNALDATE
from .imap_utf7 import encode as encode_utf7, decode as decode_utf7
- from .fixed_offset import FixedOffset
from .response_types import SearchIds
from .six import moves, iteritems, text_type, integer_types, PY3, binary_type, string_types
xrange = moves.xrange
# ...and IDLE
if 'IDLE' not in imaplib.Commands:
- imaplib.Commands['IDLE'] = imaplib.Commands['APPEND']
+ imaplib.Commands['IDLE'] = imaplib.Commands['APPEND']
+# ..and STARTTLS
+if 'STARTTLS' not in imaplib.Commands:
+ imaplib.Commands['STARTTLS'] = ('NONAUTH',)
-# and ID. RFC2971 says that this command is valid in all states, but not that
-# some servers (*cough* FastMail *cough*) don't seem to accept it in state
-# NONAUTH.
++# ...and ID. RFC2971 says that this command is valid in all states,
++# but not that some servers (*cough* FastMail *cough*) don't seem to
++# accept it in state NONAUTH.
+ if 'ID' not in imaplib.Commands:
+ imaplib.Commands['ID'] = ('NONAUTH', 'AUTH', 'SELECTED')
+
# System flags
DELETED = r'\Deleted'
"""Get a listing of folders on the server as a list of
``(flags, delimiter, name)`` tuples.
- Calling list_folders with no arguments will list all
- folders.
+ Specifying *directory* will limit returned folders to the
+ given base directory. The directory and any child directories
+ will returned.
- Specifying *directory* will limit returned folders to that
- base directory. Specifying *pattern* will limit returned
- folders to those with matching names. The wildcards are
- supported in *pattern*. ``*`` matches zero or more of any
- character and ``%`` matches 0 or more characters except the
- folder delimiter.
+ Specifying *pattern* will limit returned folders to those with
+ matching names. The wildcards are supported in
+ *pattern*. ``*`` matches zero or more of any character and
+ ``%`` matches 0 or more characters except the folder
+ delimiter.
- Folder names are always returned as unicode strings, and decoded from
- modifier utf-7, except if folder_decode is not set.
+ Calling list_folders with no arguments will recursively list
+ all folders available for the logged in user.
+
+ Folder names are always returned as unicode strings, and
+ decoded from modified UTF-7, except if folder_decode is not
+ set.
"""
- return self._do_list('LIST', directory, pattern)
+ return self._do_list(b'LIST', directory, pattern)
def xlist_folders(self, directory="", pattern="*"):
"""Execute the XLIST command, returning ``(flags, delimiter,