- Convenience methods are provided for commonly used functionality.
- Exceptions are raised when errors occur.
-Python versions 2.6, 2.7, 3.3 and 3.4 are officially supported.
+Python versions 2.6, 2.7, 3.3, 3.4 and 3.5 are officially supported.
The current stable version of IMAPClient is 1.0.1. It is licensed
under the New BSD License.
The livetest functionality can also be accessed like this::
- python -m imapclient.livetest ...
+ python -m imapclient.livetest <livetest.ini> [ optional unittest arguments ]
Alternatively you can run the ``livetest.py`` script included with the
-source distribution.
+source distribution. Use ``livetest.py --help`` to see usage.
-Use the --help option to see usage.
+The configuration file format is
+`described in the main documentation <http://imapclient.rtfd.io/#configuration-file-format>`_.
**WARNING**: The operations used by livetest are destructive and could
cause unintended loss of data. That said, as of version 0.9, livetest
the help (--help) for more details. You'll be prompted for a username
and password if one isn't provided on the command line.
-The connected IMAPClient instance is available as the variable "c".
+It is also possible to pass connection details as a configuration file
+like this::
+
+ python -m imapclient.interact -f <config file>
+
+See below for details of the :ref:`configuration file format<conf-files>`.
If installed, IPython will be used as the embedded shell. Otherwise
the basic built-in Python shell will be used.
-Here's an example session::
+The connected IMAPClient instance is available as the variable
+"c". Here's an example session::
$ python -m imapclient.interact -H <host> -u <user> ...
Connecting...
In [3]: c.logout()
Out[3]: b'Logging out'
+.. _conf-files:
+
+Configuration File Format
+-------------------------
+Both the IMAPClient interactive shell and the live tests take
+configuration files which specify how to to connect to an IMAP
+server. The configuration file format is the same for both.
+
+Configuration files use the INI format and must always have a section
+called ``DEFAULT``. Here's a simple example::
+
+ [DEFAULT]
+ host = imap.mailserver.com
+ username = bob
+ password = sekret
+ ssl = True
+
+The supported options are:
+
+==================== ======= =========================================================================================
+Name Type Description
+==================== ======= =========================================================================================
+host string IMAP hostname to connect to.
+username string The username to authenticate as.
+password string The password to use with ``username``.
+port int Server port to connect to. Defaults to 143 unless ``ssl`` is True.
+ssl bool Use SSL/TLS to connect.
+starttls bool Use STARTTLS to connect.
+ssl_check_hostname bool If true and SSL is in use, check that certificate matches the hostname (defaults to true)
+ssl_verify_cert bool If true and SSL is in use, check that the certifcate is valid (defaults to true).
+ssl_ca_file string If SSL is true, use this to specify certificate authority certs to validate with.
+timeout int Time out I/O operations after this many seconds.
+oauth2 bool If true, use OAUTH2 to authenticate (``username`` and ``password`` are ignored).
+oauth2_client_id string OAUTH2 client id.
+oauth2_client_secret string OAUTH2 client secret.
+oauth2_refresh_token string OAUTH2 token for refreshing the secret.
+==================== ======= =========================================================================================
+
+Acceptable boolean values are "1", "yes", "true", and "on", for true;
+and "0", "no", "false", and "off", for false.
+
+
External Documentation
----------------------
The `Unofficial IMAP Protocol Wiki <http://www.imapwiki.org/>`_ is