Skip to content

gdawg/imap-cli

 
 

Repository files navigation

Imap-CLI

Travis : Build Status

Description

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.

Quickstart

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 CLI

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.

Usage Python API

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)

Configuration

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.

Further documentation

Full documentation available soon.

Legal notices

Released under the MIT License.

About

Command line interface for imap account

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 91.2%
  • Shell 8.8%