An AI-powered email agent that can send, receive, and reply to emails intelligently using GPT-4.
Built with AgentMail — the email API for AI agents.
- Creates its own email inbox — your agent gets a unique email address
- Receives emails — processes incoming messages in real-time via webhooks
- Replies with AI — uses GPT-4 to generate contextual responses
- Manages threads — maintains conversation context across email chains
- Get a free AgentMail API key at console.agentmail.to
- Get an OpenAI API key at platform.openai.com
- Add both as Replit Secrets:
AGENTMAIL_API_KEYOPENAI_API_KEY
- Click Run!
- On startup, the agent creates a new email inbox
- A Flask server runs to receive webhook events from AgentMail
- When someone sends an email to the agent's inbox, it:
- Extracts the new content (strips quoted replies using
extracted_text) - Loads the full thread for conversation context
- Generates a reply using GPT-4
- Sends the reply back via AgentMail
- Extracts the new content (strips quoted replies using