Skip to content

AI Email Agent template — built with AgentMail + OpenAI. Fork on Replit to get started.

Notifications You must be signed in to change notification settings

agentmail-to/ai-email-agent-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AI Email Agent — AgentMail + OpenAI

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.

What it does

  1. Creates its own email inbox — your agent gets a unique email address
  2. Receives emails — processes incoming messages in real-time via webhooks
  3. Replies with AI — uses GPT-4 to generate contextual responses
  4. Manages threads — maintains conversation context across email chains

Setup

  1. Get a free AgentMail API key at console.agentmail.to
  2. Get an OpenAI API key at platform.openai.com
  3. Add both as Replit Secrets:
    • AGENTMAIL_API_KEY
    • OPENAI_API_KEY
  4. Click Run!

How it works

  • 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

Learn more

About

AI Email Agent template — built with AgentMail + OpenAI. Fork on Replit to get started.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors