MailSift AI - Chrome Extension
An AI-powered Chrome extension that intelligently prioritizes and summarizes emails across Gmail, Outlook Web, and Yahoo Mail. Built with privacy-first principles and modern web technologies.
π Features
Core Functionality
- Multi-Platform Support: Works seamlessly with Gmail, Outlook Web, and Yahoo Mail
- Smart Email Prioritization: Automatically highlights and moves important emails to the top based on user-defined keywords
- AI-Powered Summarization: Uses OpenAI GPT-4 to generate concise email summaries
- Floating Widget: Displays top 5 priority emails with summaries in a draggable widget
- Real-time Updates: Monitors inbox changes and updates prioritization dynamically
Privacy & Security
- Privacy-First Design: Never stores or logs email content
- Local Processing: All prioritization logic runs locally in your browser
- Consent-Based AI: Requires explicit user consent before using AI features
- Secure API Calls: Only sends email content (not metadata) to OpenAI
- Opt-out Anytime: Users can disable AI features at any time
User Experience
- Modern UI: Clean, intuitive interface with smooth animations
- Customizable Keywords: Add/remove priority keywords through the popup interface
- Visual Highlighting: Color-coded priority levels with badges and animations
- Draggable Widget: Position the floating widget anywhere on the page
- Responsive Design: Works on desktop and mobile browsers
π¦ Installation
For Development
- Clone the repository
git clone https://github.com/yourusername/mailsift-ai.git
cd mailsift-ai
- Open Chrome and navigate to Extensions
- Go to
chrome://extensions/
- Enable βDeveloper modeβ (toggle in top right)
- Load the extension
- Click βLoad unpackedβ
- Select the project directory
- Configure OpenAI API Key (Optional)
- Open
summarizer.js
- Replace
'sk-your-openai-api-key-here' with your actual OpenAI API key
- Note: For production, implement a secure proxy endpoint (see Security section)
For Production
- Build the extension
# Add build process if needed
npm run build
- Package for Chrome Web Store
- Zip all files (excluding development files)
- Submit to Chrome Web Store
π§ Configuration
OpenAI API Key Setup
Option 1: Direct API Key (Development Only)
// In summarizer.js
this.apiKey = 'sk-your-actual-openai-api-key';
Option 2: Secure Proxy (Recommended for Production)
// In background.js - implement proxy endpoint
async function handleProxyRequest(data) {
const response = await fetch('https://your-proxy.com/api/summarize', {
method: 'POST',
headers: { 'Authorization': 'Bearer your-proxy-key' },
body: JSON.stringify(data)
});
return response.json();
}
Default Settings
The extension comes with sensible defaults:
- Default Keywords:
['urgent', 'important', 'meeting', 'deadline']
- Highlight Mode: Enabled
- AI Summarization: Enabled (requires consent)
- Widget Display: Enabled
ποΈ Architecture
File Structure
mailsift-ai/
βββ manifest.json # Extension manifest (Manifest V3)
βββ content.js # Main content script orchestrator
βββ background.js # Service worker for lifecycle management
βββ popup.html # Settings popup interface
βββ popup.js # Popup logic and event handling
βββ popup.css # Popup styling
βββ summarizer.js # OpenAI API integration
βββ utils/
β βββ email-detector.js # Email service detection
β βββ email-extractor.js # DOM email extraction
β βββ email-prioritizer.js # Priority calculation and highlighting
β βββ widget-manager.js # Floating widget management
βββ styles/
β βββ content.css # Content script styling
βββ README.md # This file
Key Components
Email Detector (utils/email-detector.js)
- Detects which email service is being used (Gmail, Outlook, Yahoo)
- Provides service-specific DOM selectors
- Handles URL-based service identification
- Extracts email data from DOM elements
- Handles different email service layouts
- Uses MutationObserver for dynamic content updates
Email Prioritizer (utils/email-prioritizer.js)
- Calculates priority scores based on keywords
- Applies visual highlighting and reordering
- Manages user settings and preferences
- Creates and manages the floating widget
- Handles draggable functionality
- Displays email summaries and actions
Summarizer (summarizer.js)
- Integrates with OpenAI GPT-4 API
- Handles content cleaning and caching
- Includes rate limiting and error handling
π Security & Privacy
Privacy Commitments
- No Email Storage: Emails are never stored or logged
- Local Processing: Prioritization runs entirely in your browser
- Minimal Data Transfer: Only email content (not metadata) sent to OpenAI
- User Control: Full control over what data is processed
Security Best Practices
- API Key Protection: Use proxy endpoints in production
- Content Sanitization: All content is cleaned before API calls
- Rate Limiting: Built-in protection against API abuse
- Error Handling: Graceful degradation when services are unavailable
Implementing Secure Proxy
For production use, implement a secure proxy endpoint:
// Example Node.js proxy endpoint
app.post('/api/summarize', async (req, res) => {
const { content, options } = req.body;
// Validate and sanitize input
const cleanContent = sanitizeContent(content);
// Make OpenAI API call with server-side key
const response = await openai.chat.completions.create({
model: 'gpt-4',
messages: [
{ role: 'system', content: 'Summarize email content concisely' },
{ role: 'user', content: cleanContent }
]
});
res.json({ summary: response.choices[0].message.content });
});
π― Usage
Getting Started
- Install the extension
- Navigate to Gmail, Outlook, or Yahoo Mail
- Accept the privacy consent dialog
- Add priority keywords in the extension popup
- Watch as important emails are highlighted and moved to the top
Managing Keywords
- Click the extension icon to open settings
- Add keywords like βurgentβ, βmeetingβ, βdeadlineβ
- Keywords are matched against subject, sender, and content
- Remove keywords by clicking the Γ button
- The floating widget shows top 5 priority emails
- Drag the widget to reposition it
- Click minimize to collapse the widget
- Use the refresh button to update the display
AI Summarization
- Click the π€ button on any email to generate a summary
- Summaries are cached to avoid duplicate API calls
- Disable summarization in settings if desired
π οΈ Development
Prerequisites
- Chrome browser with developer mode enabled
- Basic knowledge of JavaScript and Chrome Extensions
- OpenAI API key (for AI features)
Development Workflow
- Make changes to source files
- Reload the extension in
chrome://extensions/
- Refresh the email page to see changes
- Use Chrome DevTools for debugging
Testing
- Test on all supported email services
- Verify keyword matching and prioritization
- Test widget functionality and responsiveness
- Ensure privacy features work correctly
Building for Production
- Update version in
manifest.json
- Implement secure proxy endpoint
- Remove development comments and console logs
- Package and submit to Chrome Web Store
π€ Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
Development Guidelines
- Follow existing code style and patterns
- Add meaningful comments for complex logic
- Test changes across all supported email services
- Ensure privacy and security features remain intact
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- OpenAI for providing the GPT-4 API
- Chrome Extensions team for the excellent documentation
- The open-source community for inspiration and tools
π Support
- Issues: Report bugs and feature requests on GitHub
- Documentation: Check the code comments for implementation details
- Security: Report security issues privately to the maintainers
π Changelog
Version 1.0.0
- Initial release
- Support for Gmail, Outlook, and Yahoo Mail
- AI-powered email prioritization and summarization
- Floating widget with draggable functionality
- Privacy-first design with user consent
- Modern, responsive UI
Note: This extension is designed as a productivity tool with privacy in mind. Always review the privacy policy and ensure youβre comfortable with how your data is processed before using AI features.