Command line interface and API for imap accounts. It provide the following actions through a minial python library:
- Get imap account status (New mails, mail counting… etc…)
- Get list of mails in INBOX (or any other directory)
- Read mail
- Flag mail (Read, Unread, Delete… etc…_
- Reply, Forward, Bounce mails
NOTE: Some of these commands aren't working yet. The project is in a development phase.
You can read about my initial motivation to write this software here.
Install imap-cli with the following command :
pip install imap-cli
Then, configure imap-cli creating a configuration file in ~/.config/imap-cli
containing :
imap_account="imaps://imap.gentux.io/"
imap_pass = 'secret'
imap_user = userName
If you want to add a minimal autocompletion, you can copy imapcli_bash_completion.sh
in the file
/etc/bash_completion.d/imapcli
Usage:
imap-cli status
imap-cli list [<directory>]
imap-cli read [<directory>] <mail-id>
imap-cli flag <mail-id>
imap-cli delete <mail-id>
imap-cli reply <mail-id>
imap-cli forward <mail-id>
imap-cli bounce <mail-id>
-f, --format=<FMT> Output format
-v, --verbose Generate verbose messages
-V, --python-verbose Generate verbose messages in python script
-h, --help Show help options.
--version Print program version.
----
imap-cli 0.1.0
Copyright (C) 2014 Romain Soufflet
License MIT
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
from imap_cli import config, helpers
config_filename = '~/.config/imap-cli'
ctx = config.new_context_from_file(config_filename)
helpers.connect(ctx)
for directory_info in status(ctx):
print ctx.format_status.format(**directory_info)
The file config-example.ini
show you available parameters and their default value when they have one.
You can also find in this file some comment describing all possibilities about each parameters.
File configuration is not the only possibility. As the package imap-cli is designed to be an API, all configuration data are shared in a context object. You can load this context progamatically if you want.
Full documentation available soon.
Released under the MIT License.