OfflineIMAP
Python program that syncs IMAP mailboxes with local Maildir folders in both directions.
OfflineIMAP downloads IMAP folders into local Maildirs and keeps both sides in sync, so a Maildir client can read mail offline. The maintained code base is offlineimap3, the Python 3 port; the original Python 2 repository is no longer developed. Configuration is an INI-style file, and Python helper functions can supply passwords, folder name mapping and filters.
- Type
- Mail tool
- Interface
- Command-line tools and prompts
- Systems
- Runs on Linux, macOS and BSD, on Windows through WSL. Not available for Android.
- Language
- Python
- License
- GPL 2.0 or later
- Latest version
8.0.3- Background
- Python 3 port of the original OfflineIMAP (Python 2, no longer maintained)
- Maintained
- Yes
- Website
- offlineimap.org
- Source
- github.com/OfflineIMAP/offlineimap3
- Documentation
- offlineimap.org
Install
| System | Support | Install |
|---|---|---|
| Linux | Native | apt sudo apt install offlineimap3dnf sudo dnf install offlineimappacman sudo pacman -S offlineimappipx pipx install offlineimap |
| macOS | Native | Homebrew brew install offlineimappipx pipx install offlineimap |
| Windows | Through WSL | WSL sudo apt install offlineimap3No native Windows package; use WSL. |
| BSD | Native | FreeBSD pkg pkg install mail/py-offlineimapOpenBSD pkg_add offlineimap |
| Android | Not supported | - |
Protocols and features
| Protocol | OfflineIMAP |
|---|---|
| IMAP | Yes |
| POP3 | No |
| SMTP | No |
| JMAP | No |
| Maildir | Yes |
| mbox | No |
| notmuch | No |
| Feature | OfflineIMAP |
|---|---|
| OpenPGP | No |
| S/MIME | No |
| OAuth2 sign-in | Yes |
| Threads | No |
| Search | No |
| HTML mail | No |
| Mouse | No |
| Multiple accounts | Yes |
| Offline use | keeps a full local Maildir copy |
| Calendar | No |
| Contacts | No |
| Vim-style keys | No |
| Configuration | ~/.offlineimaprc or ~/.config/offlineimap/config (INI) |
Pros and cons
Pros
- Built-in XOAUTH2 support for Gmail and similar providers
- Python hooks (pythonfile) for passwords, folder name mapping and filtering
- Can sync accounts in parallel and run repeatedly with autorefresh
Cons
- Slower than isync on large mailboxes
- Older guides and some packages still point to the unmaintained Python 2 version
- Only IMAP and Maildir; no POP3 and no sending
Use OfflineIMAP with Forward Email
How OfflineIMAP fits with a Forward Email mailbox. Replace you@example.com with your alias and the password command with your own. The same settings work with any provider once the server names change.
[general]
accounts = forwardemail
pythonfile = ~/.offlineimap.py
[Account forwardemail]
localrepository = forwardemail-local
remoterepository = forwardemail-remote
[Repository forwardemail-local]
type = Maildir
localfolders = ~/Mail/forwardemail
[Repository forwardemail-remote]
type = IMAP
remotehost = imap.forwardemail.net
remoteport = 993
ssl = yes
sslcacertfile = OS-DEFAULT
remoteuser = you@example.com
remotepasseval = get_pass("forwardemail/you@example.com")
# ~/.offlineimap.py
# import subprocess
# def get_pass(name):
# return subprocess.check_output(["pass", "show", name]).decode().splitlines()[0]| Protocol | Server | Port | Security |
|---|---|---|---|
| IMAP | imap.forwardemail.net | 993 | SSL/TLS |
| POP3 | pop3.forwardemail.net | 995 | SSL/TLS |
| SMTP | smtp.forwardemail.net | 465 | SSL/TLS |
| SMTP | smtp.forwardemail.net | 587 | STARTTLS |
Username: your full alias address, such as you@example.com. Password: the one shown by Generate Password next to the alias in your Forward Email account. Folders: INBOX, Drafts, Sent Mail, Trash, Spam and Archive.
Prefer no config at all? Forward Email's terminal app signs in with your account and has mail, calendar and contacts in one program.
Questions
Does OfflineIMAP work on Windows?
Not natively. It runs in Windows Subsystem for Linux (WSL). No native Windows package; use WSL.
Does OfflineIMAP support IMAP?
Yes, OfflineIMAP connects to IMAP servers directly.
Is OfflineIMAP open source?
Yes, under the GPL 2.0 or later.
How do I use OfflineIMAP with Forward Email?
Use the config in the Forward Email section on this page, saved as ~/.offlineimaprc, and replace the address and password with your own.
Sources
- offlineimap.org/
- github.com/OfflineIMAP/offlineimap3
- github.com/OfflineIMAP/offlineimap3/blob/master/README.md
- github.com/OfflineIMAP/offlineimap3/blob/master/offlineimap.conf
- github.com/OfflineIMAP/offlineimap3/blob/master/pyproject.toml
- github.com/OfflineIMAP/offlineimap
- pypi.org/project/offlineimap/
- packages.debian.org/search?keywords=offlineimap3&searchon=names&exact=1
- packages.ubuntu.com/offlineimap3
- mdapi.fedoraproject.org/rawhide/pkg/offlineimap
- archlinux.org/packages/extra/any/offlineimap/
- formulae.brew.sh/formula/offlineimap
- freshports.org/mail/py-offlineimap/
- openports.pl/path/mail/offlineimap