Prerequisites
The following example requires theopenai library.
Example
cookbook/91_tools/email_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Send email through Gmail SMTP with EmailTools.
openai library.
uv pip install -U openai
from agno.agent import Agent
from agno.tools.email import EmailTools
receiver_email = "<receiver_email>"
sender_email = "<sender_email>"
sender_name = "<sender_name>"
sender_passkey = "<sender_passkey>"
agent = Agent(
tools=[
EmailTools(
receiver_email=receiver_email,
sender_email=sender_email,
sender_name=sender_name,
sender_passkey=sender_passkey,
)
]
)
agent.print_response("send an email to <receiver_email>")
| Parameter | Type | Default | Description |
|---|---|---|---|
receiver_email | Optional[str] | None | The email address of the receiver. |
sender_name | Optional[str] | None | The name of the sender. |
sender_email | Optional[str] | None | The email address of the sender. |
sender_passkey | Optional[str] | None | The passkey for the sender’s email. |
enable_email_user | bool | True | Enable the email_user function. |
all | bool | False | Enable all available functions. |
| Function | Description |
|---|---|
email_user | Emails the user with the given subject and body. Parameters include subject (str) for the email subject and body (str) for the email content. Currently works with Gmail. Returns “email sent successfully” or error message. |
Was this page helpful?