Error when using the XOAUTH2 token refresh logic:
  ("POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str. (configuration is: {....}", <traceback object at 0x7fc6e69f2b40>)
     ['  File ".../offlineimap3/offlineimap/accounts.py", line 298, in syncrunner
        self.__sync()
    ', '  File ".../offlineimap3/offlineimap/accounts.py", line 374, in __sync
        remoterepos.getfolders()
    ', '  File ".../offlineimap3/offlineimap/repository/IMAP.py", line 446, in getfolders
        imapobj = self.imapserver.acquireconnection()
    ', '  File ".../offlineimap3/offlineimap/imapserver.py", line 579, in acquireconnection
        self.__authn_helper(imapobj)
    ', '  File ".../offlineimap3/offlineimap/imapserver.py", line 443, in __authn_helper
        if func(imapobj):
    ', '  File ".../offlineimap3/offlineimap/imapserver.py", line 377, in __authn_xoauth2
        imapobj.authenticate(\'XOAUTH2\', self.__xoauth2handler)
    ', '  File ".../offlineimap3/venv/lib/python3.7/site-packages/imaplib2.py", line 681, in authenticate
        typ, dat = self._simple_command(\'AUTHENTICATE\', mechanism.upper())
    ', '  File ".../offlineimap3/venv/lib/python3.7/site-packages/imaplib2.py", line 1674, in _simple_command
        return self._command_complete(self._command(name, *args), kw)
    ', '  File ".../offlineimap3/venv/lib/python3.7/site-packages/imaplib2.py", line 1394, in _command
        literal = literator(data, rqb)
    ', '  File ".../offlineimap3/venv/lib/python3.7/site-packages/imaplib2.py", line 2237, in process
        ret = self.mech(self.decode(data))
    ', '  File ".../offlineimap3/offlineimap/imapserver.py", line 253, in __xoauth2handler
        raise type(e)(msg, exc_info()[2])
    ']
Fix by encoding the data passed to urllib.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
		
	
Upstream status (master branch):

Upstream status (next branch):
Links:
- Official github code repository: offlineimap
 - Website: website
 - Wiki: wiki
 - Blog: blog
 
OfflineIMAP
"Get the emails where you need them."
Description
OfflineIMAP is software that downloads your email mailbox(es) as local Maildirs. OfflineIMAP will synchronize both sides via IMAP.
Why should I use OfflineIMAP?
IMAP's main downside is that you have to trust your email provider to not lose your email. While certainly unlikely, it's not impossible. With OfflineIMAP, you can download your Mailboxes and make you own backups of your Maildir.
This allows reading your email offline without the need for your mail reader (MUA) to support IMAP operations. Need an attachment from a message without internet connection? No problem, the message is still there.
Project status and future
As one of the maintainer of OfflineIMAP, I'd like to put my efforts into imapfw. imapfw is software in development that I intend to replace OfflineIMAP with in the long term.
That's why I'm not going to continue OfflineIMAP development. I'll continue to maintain OfflineIMAP (fixing small bugs, reviewing patches and merging, and rolling out new releases), but that's all.
While I keep tracking issues for OfflineIMAP, you should not expect future support.
You won't be left at the side. OfflineIMAP's community is large enough so that you'll find people for most of your issues.
Get news from the blog.
Nicolas Sebrecht. ,-)
License
GNU General Public License v2.
Downloads
You should first check if your distribution already packages OfflineIMAP for you. Downloads releases as tarball or zipball.
If you are running Linux Os, you can install offlineimap with:
- openSUSE 
zypper in offlineimap - Arch Linux 
pacman -S offlineimap - fedora 
dnf install offlineimap 
Feedbacks and contributions
The user discussions, development, announcements and all the exciting stuff take place on the mailing list. While not mandatory to send emails, you can subscribe here.
Bugs, issues and contributions can be requested to both the mailing list or the official Github project. Provide the following information:
- system/distribution (with version)
 - offlineimap version (
offlineimap -V) - Python version
 - server name or domain
 - CLI options
 - Configuration file (offlineimaprc)
 - pythonfile (if any)
 - Logs, error
 - Steps to reproduce the error
 
The community
- OfflineIMAP's main site is the project page at Github.
 - There is the OfflineIMAP community's website.
 - And finally, the wiki.
 
Requirements & dependencies
- Python v3+
 - rfc6555 (required)
 - imaplib2 >= 3.5
 - gssapi (optional), for Kerberos authentication
 - portalocker (optional), if you need to run offlineimap in Cygwin for Windows
 
Documentation
All current and updated documentation is on the community's website.
Read documentation locally
You might want to read the documentation locally. Get the sources of the website. For the other documentation, run the appropriate make target:
$ ./scripts/get-repository.sh website
$ cd docs
$ make html  # Requires rst2html
$ make man   # Requires a2x (http://asciidoc.org)
$ make api   # Requires sphinx