Provides email automation tools for AI agents with automatic backend switching between AgentMail and standard SMTP/IMAP.
# Source: https://github.com/MervinPraison/PraisonAI | License: MIT
# Provided via justclaw.it.com; keep this notice with the code.
"""
Email tools for PraisonAI Agents.
Generic tools (send_email, list_emails, etc.) auto-detect the backend:
- If AGENTMAIL_API_KEY is set → uses AgentMail API
- If EMAIL_ADDRESS + EMAIL_PASSWORD is set → uses IMAP/SMTP
- If both are set → prefers AgentMail
Backend-specific tools are also available:
- AgentMail: agentmail_send_email, agentmail_list_emails, etc.
- SMTP/IMAP: smtp_send_email, smtp_read_inbox, smtp_search_inbox, etc.
Example:
from praisonaiagents.tools.email_tools import send_email, list_emails, search_emails
agent = Agent(tools=[send_email, list_emails, search_emails])
# Works with either AgentMail or Gmail/Outlook — aut
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key