EmailMasterAI is an intelligent, AI-powered email management system that automates email analysis, reply generation, and email composition. Built with PHP, it integrates seamlessly with multiple AI providers including OpenAI, Google Gemini, Anthropic Claude, DeepSeek, and xAI Grok.

EmailMasterAI Dashboard - Your AI-powered email management interface
- π§ Email Loading & Storage - Automatically fetch and store emails from IMAP servers
- π€ AI-Powered Analysis - Analyze email content, extract insights, and generate summaries
- βοΈ Smart Reply Generation - Automatically generate professional email replies using AI
- π Email Composition - Create new emails with AI-generated content
- π Multi-Language Support - Works with emails in any language (English, Gujarati, Hindi, etc.)
- β‘ Background Processing - Non-blocking email loading with real-time progress tracking
- β OpenAI (GPT-4o, GPT-4o-mini, GPT-3.5-turbo)
- β Google Gemini (Gemini 2.5 Flash, Gemini 2.5 Pro, Gemini 3 Pro)
- β Anthropic Claude (Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku)
- β DeepSeek (OpenAI-compatible API)
- β xAI Grok (Grok-4 and other models)
- IMAP/SMTP Integration - Works with Gmail, Outlook, Yahoo, and any IMAP/SMTP provider
- HTML Email Support - Properly renders HTML emails
- MIME Decoding - Handles encoded email headers and content
- UTF-8 Encoding - Full support for international characters
- Error Handling - Comprehensive error handling and validation
- Security - Secure credential management and input sanitization
- PHP 8.3 or higher
- Web server (Nginx or Apache)
- PHP extensions:
imap,curl,mbstring,iconv - AI API key (OpenAI, Gemini, Anthropic, DeepSeek, or Grok)
- Clone the repository:
git clone https://github.com/jasminvdev/emailMasterAi.git
cd emailMasterAI- Install PHP extensions (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install php8.3-imap php8.3-curl php8.3-mbstring php8.3-iconv
sudo phpenmod -v 8.3 imap curl mbstring iconv
sudo systemctl restart php8.3-fpm- Configure the application:
# Copy the example configuration file
cp config.php.example config.php
# Edit config.php with your credentials
nano config.php # or use your preferred editor- The
config.phpfile contains sensitive credentials (API keys, passwords) and is excluded from Git for security - You must create
config.phpfromconfig.php.exampleand fill in your own credentials - The
config.php.examplefile is a template with placeholder values - it will not work until you copy it and configure it
- Set permissions:
sudo chown -R www-data:www-data .
sudo chmod -R 755 .
sudo mkdir -p emails
sudo chmod 755 emails- Verify your setup:
http://your-domain/emailMasterAI/test_setup.php
This will check all your configurations and connections. See the Testing & Verification section below for details.
- Access the application:
http://your-domain/emailMasterAI/
Before using EmailMasterAI, you must configure it:
-
Copy the example configuration file:
cp config.php.example config.php
-
Edit
config.phpwith your credentials:nano config.php # or use your preferred editor (vim, code, etc.) -
Fill in all required values (see sections below for details)
Why is config.php not in Git?
config.phpcontains sensitive information (passwords, API keys, email credentials)- It's excluded from version control for security reasons
- Each user must create their own
config.phpfrom theconfig.php.exampletemplate - The example file shows all available configuration options with placeholders
Edit config.php with your email credentials:
// IMAP Configuration (for reading emails)
define('IMAP_HOST', 'imap.gmail.com');
define('IMAP_PORT', 993);
define('IMAP_ENCRYPTION', 'ssl');
define('IMAP_USERNAME', 'your-email@gmail.com');
define('IMAP_PASSWORD', 'your-app-password');
// SMTP Configuration (for sending emails)
define('SMTP_HOST', 'smtp.gmail.com');
define('SMTP_PORT', 587);
define('SMTP_ENCRYPTION', 'tls');
define('SMTP_USERNAME', 'your-email@gmail.com');
define('SMTP_PASSWORD', 'your-app-password');Note: For Gmail, you need to use App Passwords instead of your regular password.
define('AI_PROVIDER', 'gemini');
define('AI_API_KEY', 'your-gemini-api-key');
define('AI_MODEL', 'gemini-2.5-flash'); // Free tier modeldefine('AI_PROVIDER', 'openai');
define('AI_API_KEY', 'sk-your-openai-key');
define('AI_MODEL', 'gpt-4o-mini');
define('AI_BASE_URL', 'https://api.openai.com/v1');define('AI_PROVIDER', 'anthropic');
define('AI_API_KEY', 'sk-ant-your-key');
define('AI_MODEL', 'claude-3-5-sonnet-20241022');define('AI_PROVIDER', 'deepseek');
define('AI_API_KEY', 'your-deepseek-key');
define('AI_MODEL', 'deepseek-chat');
define('AI_BASE_URL', 'https://api.deepseek.com');define('AI_PROVIDER', 'grok');
define('AI_API_KEY', 'your-xai-key');
define('AI_MODEL', 'grok-4');
define('AI_BASE_URL', 'https://api.x.ai/v1');Load emails from your IMAP server with background processing and real-time progress tracking.

Load emails from your IMAP server with real-time progress tracking
Use natural language to analyze your emails:
- "Summarize all emails from last week"
- "Which emails require immediate action?"
- "Translate important emails to Gujarati"
- "List all meeting requests from the last 5 days"
Create professional replies with simple instructions:
- "Reply politely that I will check and get back soon"
- "Thank them for the email and ask for more details"
- "Accept the meeting request"

Generate professional email replies using AI with simple natural language instructions
Generate emails from scratch:
- "Write a professional email to request a meeting next week"
- "Send a thank you email for the interview"
- "Ask for product pricing information"

Compose and send new emails with AI-generated content
emailMasterAI/
βββ api/ # API endpoints
β βββ analyze_emails.php
β βββ generate_email.php
β βββ generate_reply.php
β βββ load_emails.php
β βββ send_email.php
βββ includes/ # Core PHP classes
β βββ AIService.php # AI API integration
β βββ EmailReader.php # IMAP email reading
β βββ EmailSender.php # SMTP email sending
β βββ MimeDecoder.php # MIME header decoding
βββ assets/ # Frontend assets
β βββ css/style.css
β βββ js/app.js
β βββ images/ # Screenshots and images
βββ config.php.example # Configuration template (copy to config.php)
βββ config.php # Your configuration (create from example, NOT in repo)
βββ index.html # Main UI
βββ README.md
POST /api/load_emails.php- Load emails from IMAPGET /api/get_saved_emails.php- List saved emailsPOST /api/get_saved_email.php- Get single email
POST /api/analyze_emails.php- Analyze emails with AIPOST /api/generate_reply.php- Generate email replyPOST /api/generate_email.php- Generate new email
POST /api/send_reply.php- Send email replyPOST /api/send_email.php- Send new email
After installation, verify your setup using the built-in test script:
Access the test page:
http://your-domain/emailMasterAI/test_setup.php
The test script checks:
- β PHP version and extensions
- β IMAP connection
- β AI API connection
- β Database connection (if enabled)
- β File permissions
- β Configuration values

Setup verification page showing all system checks and connection status
- Never commit
config.php- Contains sensitive credentials (automatically excluded via.gitignore) - Use
config.php.example- This template file IS in the repo and shows all configuration options - Create
config.phplocally - Copy from example:cp config.php.example config.php - Use App Passwords - For Gmail and other providers (never use regular passwords)
- Environment Variables - Consider using
.envfiles in production - Input Sanitization - All user inputs are sanitized
- HTTPS Recommended - Use HTTPS in production
- Protect
emails/directory - Contains personal email data (excluded from Git)
- User Guide - Complete user documentation
- Developer Documentation - Technical documentation for developers
- API Reference - API endpoint documentation
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
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with PHP 8.3+
- Uses IMAP and SMTP for email operations
- Integrates with multiple AI providers
- Inspired by the need for intelligent email management
Email management, AI email assistant, automated email replies, email analysis, AI-powered email, email automation, smart email, email AI, GPT email, Gemini email, Claude email, email productivity, IMAP automation, SMTP automation, email workflow, AI email tool, email management system, intelligent email, email assistant, automated email responses
If you find this project useful, please consider giving it a star on GitHub!
Made with β€οΈ for better email management
For issues, questions, or contributions, please open an issue on GitHub.