Skip to content

This Python project provides an interactive prompt to use the Fastmail API, summarize emails and generate replies to them using a local Ollama API.

Notifications You must be signed in to change notification settings

jakecamara/fastmail-ollama-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fastmail / Ollama Interactive CLI Tool

This Python project processes emails using the Fastmail API and summarizes or generates replies to them using a local Ollama API.

Features

  • Fetch and list emails from your Fastmail inbox.
  • Clean email content by removing HTML and CSS to prepare it for processing.
  • Summarize emails using the Ollama API.
  • Generate polite and professional replies.
  • Fully interactive CLI for selecting and processing emails.

Roadmap

  • Automatically save Ollama-generated replies as drafts in your Fastmail account.
  • Tag emails with labels based on Ollama's analysis.
  • Automatically or manually move emails to folders.
  • Delete emails directly from the CLI.
  • Process multiple emails at once for summarization, replies, or folder assignment.
  • Generate tasks from email content and export to external tools like Todoist or Trello.

Requirements

  • Python 3.7 or later
  • Fastmail API credentials
  • Access to an Ollama instance

Setup Instructions

1. Clone the Repository

git clone https://github.com/jakeandco/fastmail-ollama-cli.git
cd fastmail-ollama-cli

2. Create a Virtual Environment

Create a virtual environment in the project directory:

python -m venv venv

Activate the virtual environment:

  • Windows:
.\venv\Scripts\activate
  • macOS/Linux:
source venv/bin/activate

3. Install Dependencies

Install the required dependencies using pip:

pip install -r requirements.txt

4. Create a .env File

Create a .env file in the project directory to store sensitive credentials:

touch .env

Add the following variables to .env:

API_TOKEN=your_fastmail_api_token
ACCOUNT_ID=your_account_id
API_URL=https://api.fastmail.com/jmap/api/
OLLAMA_URL=http://ollama:11434/api/generate

Usage

Run the script to start the interactive email processor:

python main.py

Interactive CLI Features

  • Lists emails from your Fastmail inbox.
  • Allows you to select an email to summarize or reply to.
  • Generates replies or summaries using the Ollama API.

Updating Dependencies

To update or add dependencies, install the package and update requirements.txt:

pip install <package_name>
pip freeze > requirements.txt

Troubleshooting

  • Missing Module Error: Ensure the virtual environment is activated and dependencies are installed.
  • API Errors: Verify the credentials in your .env file and that the API endpoint exists on your Ollama server.

License

This project is licensed under the MIT License.

About

This Python project provides an interactive prompt to use the Fastmail API, summarize emails and generate replies to them using a local Ollama API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages