Overview
The Email Agent is a microservice that automates email handling, including reading, composing, sending, and responding to emails using AI. Location:scripts/email_agent_microservice/
Features
Email Reading
Fetch and parse emails from Gmail/Outlook
AI Composition
Generate email drafts with Claude
Smart Sending
Send emails with tracking
Auto-Response
Automated responses based on rules
Architecture
Service Structure
Email Processing Flow
Email Composition
AI-Powered Drafting
Template Variables
Email Reading
Fetch Emails
Email Parsing
Email Sending
Send Email
Track Sent Emails
Operating Modes
Draft Mode
User reviews all emails before sending:Manual Mode
AI suggests responses, user selects:Auto Mode
Fully automated for specific rules:API Integration
Backend Endpoints
Configuration
Environment Variables
Examples
Frontend Integration
Troubleshooting
Failed to send email
Failed to send email
Causes:
- OAuth token expired
- Invalid recipient email
- Rate limit exceeded
- Reconnect OAuth account
- Validate email addresses
- Check provider rate limits
AI composition taking too long
AI composition taking too long
Cause: Large context or complex requirementsSolution:
- Reduce context size
- Use faster Claude model (haiku)
- Implement timeout handling
