About this project
EmailNinja was designed to simplify invoice and document management for businesses that receive large numbers of supplier emails. Instead of manually searching inboxes, downloading attachments, organizing folders, and tracking extraction history, the application centralizes the entire workflow inside a single desktop interface.
Users securely connect one or multiple Gmail accounts using Google's OAuth authentication. They upload a CSV file listing supplier email addresses and optional date filters. The application builds optimized Gmail search queries using the has:attachment operator and date range filters, then extracts all matching emails across all suppliers — deduplicating supplier entries and tracking progress per supplier.
For each extracted email, the application retrieves the full message including subject, sender, date, body text, and all attachments. PDF files are downloaded to timestamped extraction folders organized by run, with duplicate filename handling. Each extraction run is tracked in the database with statistics on total emails found, successfully extracted, and failed — with retry capability for failed extractions.
A Google Drive integration allows users to connect Drive accounts, browse and select target folders, and upload extracted PDF documents. The upload system includes retry logic with exponential backoff for network errors, duplicate upload detection, pause/resume functionality, and post-upload verification that confirms files exist in Drive.
An OCR module powered by Tesseract extracts invoice data from PDF documents — parsing invoice numbers, dates, total amounts, tax amounts, supplier names, and line items using multi-language regex patterns supporting English, French, German, Spanish, and Italian.
All data is stored in a local SQLite database covering suppliers, invoices, invoice items, Gmail accounts, Drive accounts, extraction runs, emails, and drive uploads. The application features a dark-theme interface inspired by VS Code, with sidebar navigation, tabbed views, and real-time progress tracking. It is packaged as a Windows EXE via PyInstaller and distributed with an Inno Setup installer.

