Skip to main content
Give your agents the ability to send and read emails. Two backends available — choose one or both.

Quick Start

Zero-config email via the AgentMail API. No IMAP/SMTP setup.
from praisonaiagents import Agent
from praisonaiagents.tools import send_email, list_emails, read_email

agent = Agent(
    name="EmailAgent",
    instructions="You help send and manage emails.",
    tools=[send_email, list_emails, read_email]
)

agent.start("Send an email to bob@example.com about tomorrow's meeting")
export AGENTMAIL_API_KEY="am_..."
export AGENTMAIL_INBOX_ID="you@agentmail.to"

Using Tool Profiles

Instead of importing individual tools, use built-in profiles:
from praisonaiagents import Agent
from praisonaiagents.tools import resolve_profiles

# AgentMail tools
agent = Agent(
    name="EmailAgent",
    instructions="Handle emails",
    tools=resolve_profiles("email")   # send_email, list_emails, read_email
)

# SMTP/IMAP tools
agent = Agent(
    name="EmailAgent",
    instructions="Handle emails",
    tools=resolve_profiles("smtp_email")  # smtp_send_email, smtp_read_inbox
)

Available Tools

AgentMail Tools

Requires: pip install agentmail + AGENTMAIL_API_KEY
ToolDescription
send_email(to, subject, body)Send an email to a recipient
list_emails(limit=10)List recent emails in the inbox
read_email(message_id)Read full content of a specific email
list_inboxes()List all inboxes for this API key

SMTP/IMAP Tools

Requires: EMAIL_ADDRESS + EMAIL_PASSWORD (no extra packages)
ToolDescription
smtp_send_email(to, subject, body)Send email via SMTP
smtp_read_inbox(limit=10, folder="INBOX")Read recent emails via IMAP
SMTP/IMAP tools auto-detect server settings for Gmail, Outlook, Yahoo, and iCloud. Override with EMAIL_SMTP_SERVER / EMAIL_IMAP_SERVER if needed.

YAML Configuration

# agentmail-bot.yaml
agent:
  name: "Email Assistant"
  instructions: "Handle emails concisely"
  model: "gpt-4o-mini"
  tools:
    - send_email
    - list_emails
    - read_email
praisonai bot start --config agentmail-bot.yaml

Environment Variables

VariableBackendDefaultDescription
AGENTMAIL_API_KEYAgentMailAPI key from agentmail.to
AGENTMAIL_INBOX_IDAgentMailInbox email address
EMAIL_ADDRESSSMTP/IMAPYour email address
EMAIL_PASSWORDSMTP/IMAPApp Password (recommended)
EMAIL_SMTP_SERVERSMTP/IMAPAuto-detectedSMTP server hostname
EMAIL_IMAP_SERVERSMTP/IMAPAuto-detectedIMAP server hostname

Gmail Setup

  1. Enable 2-Factor Authentication
  2. Generate App Password at Google Account
  3. Use App Password as EMAIL_PASSWORD

Email Bot

Deploy always-on email bots with polling

Messaging Bots

All supported messaging platforms