Quick Start Guide
Get Mailpilot processing your emails in just 5 minutes.
Prerequisites
Before starting, you'll need:
- ✅ Node.js 22+ installed
- ✅ An email account with IMAP access
- ✅ An LLM API key (OpenAI, Anthropic, or Ollama running locally)
Step 1: Install
git clone https://github.com/metal0/mailpilot.git
cd mailpilot
pnpm installStep 2: Create Configuration
Copy the example configuration:
cp config.example.yaml config.yamlEdit config.yaml with this minimal setup:
llm_providers:
- name: openai
api_url: https://api.openai.com/v1/chat/completions
api_key: ${OPENAI_API_KEY}
default_model: gpt-4o-mini
accounts:
- name: personal
imap:
host: imap.gmail.com
port: 993
username: ${GMAIL_USER}
password: ${GMAIL_APP_PASSWORD}
folders:
- name: INBOX
llm_provider: openai
prompt: |
Classify this email into ONE of these categories:
- important: Urgent emails requiring immediate attention
- newsletters: Marketing and promotional emails
- social: Social media notifications
- receipts: Purchase confirmations and receipts
- spam: Unwanted or suspicious emails
Return your classification as JSON:
{
"action": "move",
"folder": "category-name",
"confidence": 0.95
}Step 3: Set Environment Variables
Create a .env file or export variables:
export OPENAI_API_KEY="sk-..."
export GMAIL_USER="you@gmail.com"
export GMAIL_APP_PASSWORD="xxxx xxxx xxxx xxxx"Gmail App Password: You need to generate an app password from your Google Account settings, not your regular password.
Step 4: Build and Run
pnpm build
pnpm startYou should see output like:
[INFO] Mailpilot starting...
[INFO] Dashboard available at http://localhost:8080
[INFO] Connecting to IMAP: imap.gmail.com
[INFO] Processing folder: INBOX (15 unread messages)Step 5: Access the Dashboard
Open your browser to http://localhost:8080
The dashboard shows:
- Activity Feed: Recent email classifications
- Statistics: Processing metrics
- Health Status: IMAP and LLM provider status
- Testing Sandbox: Test your prompts safely
Step 6: Test Your Rules
Before processing real emails, test your classification prompt:
- Go to Testing Sandbox in the dashboard
- Paste a sample email
- Click Test Classification
- Review the LLM's response
Adjust your prompt until you get consistent, accurate classifications.
Example Classification Results
After running for a few minutes, you should see emails automatically:
- Moved to appropriate folders (
important,newsletters, etc.) - Flagged based on importance
- Marked as read if specified
What's Happening?
Mailpilot is:
- Connecting to your IMAP server via TLS
- Fetching unread emails from INBOX
- Classifying each email using your LLM prompt
- Applying actions (move, flag, read) based on the classification
- Logging all activity to the dashboard
Common Issues
"Authentication failed"
- Gmail: Make sure you're using an app password, not your regular password
- Outlook: You need to enable IMAP access first
"LLM provider error"
- Verify your API key is correct
- Check your API usage limits
- Ensure
api_urlpoints to the correct endpoint
"No emails processed"
- Check that you have unread emails in INBOX
- Verify IMAP connection in dashboard health status
- Check logs for specific errors
Next Steps
Email Provider Setup
Configure Gmail, Outlook, or other providers with detailed guides
LLM Providers
Learn about OpenAI, Ollama, Anthropic, and other LLM options
Writing Prompts
Master prompt engineering for accurate email classification
Configuration Reference
Explore all available configuration options
Advanced Quickstart: Docker
For production deployment:
# docker-compose.yml
services:
mailpilot:
image: ghcr.io/metal0/mailpilot:latest
ports:
- "8080:8080"
volumes:
- ./config.yaml:/app/config.yaml:ro
- ./data:/app/data
environment:
- OPENAI_API_KEY=${OPENAI_API_KEY}
- GMAIL_USER=${GMAIL_USER}
- GMAIL_APP_PASSWORD=${GMAIL_APP_PASSWORD}
restart: unless-stoppeddocker compose up -dGetting Help
- Troubleshooting Guide - Common issues and solutions
- Matrix Chat - Community support
- GitHub Issues - Bug reports
Congratulations! 🎉 Your emails are now being intelligently processed by AI.