This project allows you to schedule automated weekly email updates generated by CrewAI using a simple Flask-based form UI. You specify the email time, day, and data file, and the agent handles everything — from crafting a report to sending it with attachments.
- ✅ Web form to schedule emails
- 🤖 AI-generated email content using CrewAI
- 📅 Automatically runs every week at scheduled time
- 📎 Supports file attachments
- 💬 Fun, dynamic email tone based on document content
- 🔐 Uses Microsoft Graph API for email delivery
.
├── crewai_config/
│ └── agents, tasks, and crew config files
├── static/
│ └── style.css (optional)
├── templates/
│ └── index.html (Flask form)
├── src/
│ └── emailcrew/
│ └── main.py # Main scheduling and sending logic
│ └── crew.py # Crew and Agent Defintions
│ └── config/
│ └── agents.yaml #agents prompts
│ └── tasks.yaml #task propmts
git clone https://github.com/mahadrehmann/CrewAI-Email-Agent-Flow.gitpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txtCreate a .env file with the following:
GEMINI_API_KEY=your-gemini-key
AZURE_CLIENT_ID=your-client-id (If you opt to use Outlook, you can use gmail as well)Unlike file-based polling, this project uses in-memory events to wait for user input before proceeding.
crewai runThis will:
- Start the Flask server on
http://127.0.0.1:5000 - Wait until you submit the schedule form
- Use CrewAI to generate an email
- Schedule and send it every week at the time you set
Navigate to:
http://127.0.0.1:5000Fill out this form:
- 📄 File path (input file with context)
- 📅 Day (e.g.
monday) - ⏰ Time (24h format, e.g.
14:30)
Subject: Weekly Progress Update – Done with the Email Agent
To: mahadrehman04@gmail.com
Content: A breakdown of the work performed
The system attaches a summary text file (attachment.txt) along with the email. You can modify this in main.py.