A sophisticated email campaign management system that leverages AI for content generation, featuring real-time analytics, Google authentication, and automated scheduling.
- Features
- Prerequisites
- Installation
- API Configuration
- Email Configuration
- Usage Guide
- Troubleshooting
- Maintenance
- Security
- Support
- 🤖 AI-powered email content generation using Groq API
- 📊 Real-time campaign analytics and tracking
- 📅 Automated email scheduling with throttling
- 🔐 Secure Google OAuth authentication
- 📝 Dynamic email templates with variable support
- 📈 Interactive analytics dashboard
- 🔔 Real-time notifications
- 📧 Preview functionality
- 📁 CSV integration for recipient management
- Flask-based backend
- SQLAlchemy ORM
- SendGrid ESP integration
- Server-Sent Events (SSE)
- Responsive UI design
- Chart.js analytics
- Error handling & logging
- Rate limiting & throttling
- Python 3.8+
- pip
- Git
- SendGrid account
- Groq API access
- Google Cloud account
-
Clone Repository bash git clone https://github.com/yourusername/email-campaign-system.git cd email-campaign-system
-
Set Up Virtual Environment bash python -m venv venv Windows venv\Scripts\activate Unix/MacOS source venv/bin/activate
-
Install Dependencies bash pip install -r requirements.txt
-
Environment Setup bash cp .env.example .env
Edit .env with your credentials:
env
FLASK_APP=app.py
FLASK_ENV=development
SECRET_KEY=your_secure_secret_key
SENDGRID_API_KEY=your_sendgrid_api_key
GROQ_API_KEY=your_groq_api_key
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
- Database Initialization
- Create account at SendGrid
- Verify sender identity:
- Domain authentication
- Single sender verification
- Generate API key with required permissions:
- Mail Send
- Template Engine
- Stats
- Sign up at Groq
- Generate API key
- Configure permissions for LLM access
- Create project in Google Cloud Console
- Enable required APIs:
- Google OAuth2
- Gmail API
- Configure OAuth consent screen
- Create credentials
- Add authorized redirect URIs:
http://localhost:5000/google/auth https://yourdomain.com/google/auth
MAX_EMAILS_PER_DAY=2000
MAX_EMAILS_PER_HOUR=500
MAX_BATCH_SIZE=100
THROTTLE_RATE=10class EmailScheduler:
def __init__(self):
self.max_daily = int(os.getenv('MAX_EMAILS_PER_DAY'))
self.max_hourly = int(os.getenv('MAX_EMAILS_PER_HOUR'))
self.batch_size = int(os.getenv('MAX_BATCH_SIZE'))
self.throttle_rate = int(os.getenv('THROTTLE_RATE'))-
Login
- Use Google authentication
- Authorize application access
-
Upload Recipients
- Prepare CSV with headers:
- Email (required)
- Name (required)
- Company
- Role
- Custom fields
- Upload via drag-drop or file selector
- Prepare CSV with headers:
-
Create Template
- Use variable syntax:
{VariableName} - Example:
Hello {Name}, I noticed you work at {Company} as {Role}... - Preview generated content
- Save template for reuse
- Use variable syntax:
-
Schedule Campaign
- Select date/time
- Choose sending speed
- Configure throttling
- Start campaign
-
Dashboard Analytics
- Real-time sending status
- Success/failure rates
- Open/click rates
- Queue status
-
Notifications
- Campaign start/completion
- Error alerts
- Rate limit warnings
-
Rate Limiting
Error: Too many requests Solution: Adjust throttling settings -
Authentication
Error: Invalid credentials Solution: Verify API keys and OAuth setup -
Email Failures
Error: Email bounce Solution: Check recipient email format
-
Daily
- Monitor error logs
- Check sending limits
- Review analytics
-
Weekly
- Clean failed emails
- Update templates
- Backup database
-
Monthly
- Review API usage
- Update dependencies
- Optimize performance
-
API Security
- Regular key rotation
- Environment variable usage
- Access logging
-
Authentication
- HTTPS enforcement
- Rate limiting
- Session management
-
Data Protection
- Encryption at rest
- Regular backups
- Access control
- Email: roushanraj6641@gmail.com