A beautiful web interface for sending emails through Gmail automation using your existing browser sessions via Chrome DevTools Protocol (CDP).
# Linux/Mac
./setup.sh
# Windows
setup.bat
# Essential: Detects your browsers and profiles
./setup-docker.sh
# Start application
docker-compose up --build
# Activate environment
source venv/bin/activate # Linux/Mac
# venv\Scripts\activate.bat # Windows
# Start application
python3 -m main
Visit http://localhost:8000
for the web interface.
AutoMail Agent uses CDP to communicate with your browser instances. CDP is a debugging protocol that allows external applications to:
- Connect to running browser instances
- Control page navigation and interactions
- Execute JavaScript and DOM manipulation
- Reuse existing authentication sessions
This eliminates the need for storing Gmail credentials - we simply reuse your existing logged-in browser sessions.
- System Detection: Scans system for browser executables and profile directories
- Profile Isolation: Creates temporary profile copies to avoid corrupting active sessions
- Browser Launch: Starts browser with CDP debugging enabled (
--remote-debugging-port=9222
) - Security Bypass: Disables browser security features that block automation
- CDP Connection: Playwright connects to the debug port for browser control
- Session Authentication: Leverages existing Gmail cookies and session data
- DOM Navigation: Automated interaction with Gmail's web interface
- Email Composition: Fills recipient, subject, and body fields programmatically
- Send Execution: Triggers Gmail's send mechanism via JavaScript
- Clean Termination: Closes browser, cleans temporary profiles, releases ports
Platform | Chrome | Firefox | Docker | Notes |
---|---|---|---|---|
Linux | β Full | β Recommended | Best support | |
Windows | β Broken | β Broken | β Limited | Does not work yet |
WSL | β Basic | Use Docker with caution |
- Windows: Native Windows support is completely broken due to incomplete subprocess method implementations for process management
- Firefox: Basic support only - not fully tested across all email scenarios
- Docker: Incomplete implementation, overly complicated setup process
- WSL Users: Docker setup is especially difficult - Chrome support very limited
- Attachments: Not currently supported
The Docker setup script performs critical system detection but has limitations:
./setup-docker.sh
What it does:
- Dynamic Browser Detection: Finds installed browsers (Chrome, Firefox, Edge)
- Profile Path Discovery: Locates your browser profiles for session reuse
- Creates
docker-compose.override.yml
: Dynamically generates Docker volume mounts - Cross-Platform Compatibility: Handles Linux, WSL, and Docker environments
- WSL Integration: Attempts to detect Windows browsers (with limited success)
Docker Limitations:
- Incomplete Implementation: Many features don't work properly in containers
- Complex Setup: Requires manual intervention for WSL environments
- Chrome Restrictions: Limited Chrome functionality in Docker, especially on WSL
- Profile Mounting Issues: Browser profiles often have permission conflicts in containers
Without this script, Docker containers can't access your browser profiles or executables, making email automation impossible.
setup.sh
/setup.bat
: Creates virtual environment and installs dependencies- Linux recommended: Works best on native Linux installations
- Windows users: Currently no working solution available
- Process Hijacking: Taking control of running browser instances without disrupting user sessions
- Port Conflicts: Managing CDP debug ports when multiple browser instances exist
- Profile Locking: Browsers lock profile directories, requiring careful copying/isolation
- Instance Detection: Identifying which browser processes belong to which profiles
- Same-Origin Policy: Bypassing browser security to inject automation scripts
- CSRF Protection: Working around Gmail's CSRF tokens and security headers
- Automation Detection: Evading Gmail's bot detection mechanisms
- Headless Limitations: Many security features break in headless mode, forcing visible browser use
- Windows Subprocess: Windows process creation flags completely different from Unix
- Browser Lifecycle: Properly starting, monitoring, and terminating browser processes
- Zombie Processes: Preventing orphaned browser processes from consuming resources
- Signal Handling: Cross-platform process termination requires different approaches
- Permission Issues: Browser profiles have strict file system permissions
- Session Corruption: Risk of corrupting active user sessions during profile copying
- Database Locks: Chrome/Firefox use SQLite databases that can't be copied while locked
- Cross-Platform Paths: Profile locations vary dramatically between operating systems
- Firefox CDP: Firefox's CDP implementation is incomplete compared to Chrome
- Version Compatibility: Different browser versions have varying CDP feature support
- Extension Conflicts: Browser extensions can interfere with automation scripts
- Update Interference: Browser auto-updates can break automation compatibility
- Web Interface: Clean, modern UI for composing emails
- API Endpoints: RESTful API for programmatic access
- Profile Management: Automatic browser profile detection
- Session Reuse: No credential storage needed
- Cross-Platform: Linux support only (Windows planned but broken)
automail-agent/
βββ src/
β βββ browser/ # Browser automation core
β β βββ lunchers.py # CDP connection & process management
β β βββ mailer.py # Gmail interface automation
β β βββ finders.py # Browser detection
β β βββ profile_manager.py
β βββ routes/ # FastAPI endpoints
β βββ services/ # Business logic
β βββ schemas/ # Data models
β βββ static/ # Web UI assets
βββ setup.sh / setup.bat # Native setup
βββ setup-docker.sh # Docker environment setup
βββ docker-compose.yml # Container orchestration
curl -X POST http://localhost:8000/send-email \
-F "[email protected]" \
-F "subject=Test Email" \
-F "body=Hello from AutoMail!" \
-F "headless=true" \
-F "browser_name=chrome"
curl http://localhost:8000/profiles/chrome
# Development with live reload
docker-compose --profile dev up automail-dev
# Production mode
docker-compose up automail-headless
Note: Docker implementation is incomplete and especially problematic for WSL users.
- "No profiles found": Ensure you're logged into Gmail in your browser
- "Browser timeout": Check internet connection and Gmail login status
- "Permission errors": Re-run setup scripts or check profile directory permissions
- "CDP connection failed": Verify no other applications are using the debug port
- WSL Docker issues: Consider using native Linux instead of WSL + Docker
Requirements: Python 3.8+, Chrome browser (Linux only), Gmail account (logged in)
Status: