An AI-powered email agent that combines large language models with modern email system.
MailMind helps you read, organize, draft, and manage emails through an intuitive chat interface.
Quick Start β’ Features β’ Contacts β’ Documentation β’ Contributing β’ δΈζζζ‘£
We've added powerful file management capabilities to enhance your AI experience!
- π Document Management - Upload, create, edit, and delete knowledge documents
- π Multi-Format Support - Supports .txt, .md, .docx, .pdf, and .doc files
- π Auto Conversion - .docx, .pdf, and .doc files automatically converted to .md for AI compatibility
- βοΈ In-App Editing - Edit .txt and .md files directly in the browser
- π― Persistent Context - Knowledge base files are always accessible to AI across all sessions
- π¬ Session-Specific Files - Upload files specific to each chat session
- π Agent Filesystem Access - Files are stored in agent's filesystem at
temp_uploads/ - π§ Tool Integration - AI can read and process uploaded files using file tools
- π Instant Availability - Files immediately available without agent reload
- ποΈ Easy Management - Delete temporary files with one click
Knowledge Base:
- Navigate to the Knowledge page
- Upload documents (.txt, .md, .docx, .pdf, .doc) or create new text files
- Edit content directly in the browser
- AI automatically has access to all knowledge base documents
Temporary Files (Chat):
- In the Chat page, click the Add File button next to the input box
- Select a file to upload (max 10MB, same formats as knowledge base)
- File appears as a tag above the input box
- AI can access the file via its filesystem tools during the session
|
|
|
|
|
|
FastAPI β High-performance async web framework
LangGraph β Advanced agent orchestration
WebSocket β Real-time bidirectional communication
IMAP/SMTP β Direct email protocol integration
React 18 β Modern UI with hooks
TypeScript β Type-safe development
Tailwind CSS β Utility-first styling
Vite β Lightning-fast build tool
Axios β HTTP & WebSocket client
- OpenAI-Compatible APIs - Support for multiple LLM providers
- Tavily Search - Web search capabilities
- Subagent Architecture - Specialized task handling
- Context Management - Smart conversation tracking
- Node.js 18+ and npm
- Python 3.10+
- Email account with IMAP access (Gmail recommended)
- API keys for your chosen LLM provider
1. Clone the repository
git clone https://github.com/yourusername/mailmind.git
cd mailmind2. Configure environment variables
cd web_app
cp .env.example .env
# Edit .env with your API keys and email credentials3. Start the application
./start.shThe startup script will automatically:
- β Install Python dependencies in a virtual environment
- β Install Node.js dependencies
- β Start the backend server (default: http://localhost:2821)
- β Start the frontend dev server (default: http://localhost:2922)
4. Open your browser
Navigate to http://localhost:2922 and start managing your emails with AI!
| Variable | Description | Example |
|---|---|---|
MODEL |
Model name | gpt-4, claude-3-sonnet |
OPENAI_API_KEY |
Your API key | sk-... |
OPENAI_BASE_URL |
API endpoint | https://api.openai.com/v1 |
DISPLAY_REASONING |
Show reasoning | True/False |
| Variable | Description | Default |
|---|---|---|
USERNAME |
Your email address | - |
PASSWORD |
App-specific password | - |
IMAP_SERVER |
IMAP server address | imap.gmail.com |
SMTP_SERVER |
SMTP server address | smtp.gmail.com |
IMAP_PORT |
IMAP port | 993 |
SMTP_PORT |
SMTP port | 465 |
| Provider | Status | Notes |
|---|---|---|
| β Gmail | Fully Tested & Supported | Requires App Password. Enable IMAP in settings. |
| π Outlook | In Testing | Very complicated access through IMAP and SMTP protocols. |
Gmail Setup Guide (Recommended)
-
Enable 2-Factor Authentication
- Go to Google Account settings
- Security β 2-Step Verification
- Enable 2FA
-
Generate App Password
- Go to Google Account settings
- Security β App passwords
- Generate new app password
- Use this password in
PASSWORDfield
-
Enable IMAP Access
- Go to Gmail settings
- Forwarding and POP/IMAP
- Enable IMAP
- Save changes
-
Configure MailMind
USERNAME=yourname@gmail.com PASSWORD=[your 16-character app password] IMAP_SERVER=imap.gmail.com SMTP_SERVER=smtp.gmail.com IMAP_PORT=993 SMTP_PORT=465
| Variable | Description | Default |
|---|---|---|
BACKEND_PORT |
Backend server port | 2821 |
FRONTEND_PORT |
Frontend dev server port | 2922 |
-
Start a Conversation - Type your request in natural language:
"Summarize my unread emails" "Reply to all unread New Year greeting emails" "Delete all emails from newsletter@example.com" -
Watch the AI Work - See the agent's thought process and tool calls in real-time
-
Manage Multiple Sessions - Create new chat sessions for different tasks
| Action | Description |
|---|---|
| π Read | Fetch and display emails with filtering |
| βοΈ Send | Compose and send new emails |
| ποΈ Delete | Remove unwanted emails |
| π Move | Organize emails into folders |
| π΄ Flag | Mark as important/unread |
| π Attachments | View and download files |
Organize your contacts efficiently with our comprehensive contacts feature:
| Feature | Description |
|---|---|
| π€ Add Contacts | Create new contacts with multiple email addresses |
| βοΈ Edit Contacts | Update contact information anytime |
| ποΈ Delete Contacts | Remove contacts with confirmation |
| π·οΈ Groups | Organize contacts into custom groups |
| π Search | Find contacts by name, email, or group |
| π Alphabetical View | Contacts automatically sorted by first letter |
Benefits:
- π§ Quick access when composing emails
- π― Filter emails by contacts
- π₯ Organize contacts into groups (Family, Work, Friends, etc.)
- π Search across all contact fields instantly
Configure everything through the web UI:
- π Update API keys
- π§ Configure email servers
- π Adjust network ports
- π¨ Toggle display options
Manage your network of contacts efficiently:
Adding Contacts:
- Click the "Add Contact" button
- Enter contact name (required)
- Add one or more email addresses
- Assign to groups (e.g., Family, Work, Friends)
- Save the contact
Organizing with Groups:
- Create custom groups to categorize contacts
- Filter contacts by group in the sidebar
- Groups show contact counts
- Easily add/remove contacts from groups
Searching Contacts:
- Search by name, email, or group
- Real-time filtering as you type
- Alphabetically sorted display
- Quick access to contact details
Managing Contacts:
- βοΈ Edit any contact to update information
- ποΈ Delete with confirmation dialog
- π§ Multiple email addresses per contact
- π·οΈ Visual group tags on each contact
mailmind/
βββ deepagents/ # Core agent framework
β βββ backends/ # Backend implementations
β βββ middleware/ # Agent middleware
β βββ ...
βββ lib/ # Shared utilities
β βββ email_tools.py # Email operations
β βββ prompt.py # System prompts
β βββ ...
βββ web_app/ # Web application
β βββ backend/ # FastAPI server
β β βββ api_server.py
β β βββ requirements.txt
β βββ frontend/ # React + TypeScript UI
β β βββ src/
β β β βββ components/ # UI components
β β β βββ pages/ # Page components
β β β βββ lib/ # API & utilities
β β β βββ contexts/ # React contexts
β β βββ package.json
β β βββ vite.config.js
β βββ start.sh # Startup script
βββ .env.example # Environment template
βββ README.md # This file
cd web_app/backend
source venv/bin/activate # Activate virtual environment
python api_server.py # Start with auto-reloadcd web_app/frontend
npm run dev # Start dev server with hot reload
npm run build # Build for production
npm run preview # Preview production buildpython lib/test.pyEach chat session maintains:
- β Separate agent instance with isolated state
- β Independent email cache
- β Dedicated filesystem for file operations
- β Unique conversation history
- β WebSocket connection for instant communication
- β Stream agent responses token-by-token
- β Display tool calls and results as they happen
- β Visual feedback for agent status
- β
Caches persisted to
.emails_cache.json - β Survives server restarts
- β Automatically cleaned up on session deletion
- β Session-isolated to prevent cross-contamination
Gmail-specific issues
- Use an App Password instead of your regular password
- Enable IMAP access in Gmail settings
- Check "Less secure app access" if applicable
- Verify 2FA is enabled (required for App Passwords)
General email issues
- Check firewall/proxy settings if using a proxy
- Verify IMAP/SMTP server addresses and ports
- Ensure ports 993 (IMAP) and 465/587 (SMTP) are open
- Test connection with
telnet imap.gmail.com 993
Common API issues
- Verify API key is valid and has sufficient credits
- Check that
OPENAI_BASE_URLis correct for your provider - Some providers require specific model names
- Check rate limits and quota usage
- Review error messages in backend logs
Connection problems
- Ensure backend is running and accessible
- Check port conflicts in
.env - Verify browser console for errors
- Try refreshing the page
- Check network tab in browser DevTools
Slow performance
- Reduce email batch size in
read_emailstool - Close unused chat sessions
- Clear browser cache if UI is slow
- Check system resources (CPU, memory)
- Monitor network tab for large payloads
- β Never commit
.envfile to version control - π Use App Passwords for email authentication
- π Keep API keys secure and rotate regularly
β οΈ Be cautious with proxy configurations- π The app runs locally; avoid exposing ports to the internet
- π Check
.gitignoreto ensure sensitive files are excluded
- Email Box - Intelligent email client interface
- User File Upload - Upload files for AI chat β (v0.0.5)
- Long-term Memory - Store and retrieve conversation facts
- Advanced Search - AI-powered categorization
- Multi-Account Support - Multiple email accounts
- Email Analytics - Statistics dashboard
- AI Summaries - Thread summarization
- Calendar Integration - Google Calendar & Outlook
- More LLM APIs - Anthropic, Cohere, etc.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Built with amazing open-source tools:
- DeepAgents - Agent orchestration
- React - UI framework
- Tailwind CSS - Styling
- Lucide - Icons
- imap-tools - Email operations
- FastAPI - Backend framework
For issues and questions:
- π Report a bug
- π‘ Request a feature
- π Check existing documentation
- π§ Review troubleshooting section
Built with β€οΈ by the MailMind team
