How to Enable Email Sending in Agent Zero (Gmail Setup Guide)
To learn more about Local AI topics, check out related posts in the Local AI Series
Part of: AI Learning Series Here
Quick Links: Resources for Learning AI | Keep up with AI | List of AI Tools
Subscribe to JorgeTechBits newsletter
AI Disclaimer I love exploring new technology, and that includes using AI to help with research and editing! My digital “team” includes tools like Google Gemini, Notebook LM, Microsoft Copilot, Perplexity.ai, Claude.ai, and others as needed. They help me gather insights and polish content—so you get the best, most up-to-date information possible.
Let your AI assistant send emails on your behalf — in minutes.
Agent Zero is a powerful AI framework that can automate tasks, run code, browse the web, and much more. But one capability many users overlook is email sending — and it’s surprisingly easy to set up.
This guide walks you through enabling Gmail-based email sending in Agent Zero, so your agent can send you notifications, birthday reminders, reports, or any email you ask it to.
You can also see my other articles (tutorials, resources, Tips) on Agent Zero here
What You’ll Need
- A running instance of Agent Zero
- A Gmail account
- 5 minutes
Step 1: Enable 2-Step Verification on Your Google Account
Before you can create an App Password, Google requires 2-Step Verification to be active.
- Go to myaccount.google.com
- Click Security in the left sidebar
- Under “How you sign in to Google”, click 2-Step Verification
- Follow the setup steps if it’s not already enabled
Step 2: Create a Gmail App Password
An App Password is a special 16-character password that allows external apps to send email on your behalf — without exposing your real Gmail password.
- Go back to Security in your Google Account
- Click 2-Step Verification again
- Scroll to the bottom and click App passwords
- In the App name field, type something like
Agent Zero - Click Create
- Google will display a 16-character password — copy it immediately!
⚠️ You won’t be able to see this password again after closing the dialog. Save it somewhere safe.
Your app password will look something like this: abcd efgh ijkl mnop
Step 3: Add Your Credentials to Agent Zero
Now you need to store your Gmail address and App Password securely in Agent Zero.
- Open the Agent Zero web UI
- Click the ⚙️ Settings icon
- Navigate to External Services
- Scroll to the Secrets Management section
- Add your credentials in
KEY=VALUEformat, one per line:
GMAIL_ADDRESS=yourname@gmail.com
GMAIL_APP_PASSWORD=abcd efgh ijkl mnop
- Click Save
Tip: Secrets added here are globally available — they work across all chats and projects in Agent Zero.
Each project can also have its own secrets file atusr/projects/<project-name>/.a0proj/secrets.envthat can override global ones.
Step 4: Test It!
Now just ask Agent Zero to send you a test email. Type something like:
“Send me a test email to confirm email is working.”
Agent Zero will write and execute a Python script using smtplib to connect to Gmail’s SMTP server and send the email. If everything is configured correctly, you’ll see a success message — and the email will arrive in your inbox within seconds.
How It Works Under the Hood
Agent Zero uses Python’s built-in smtplib library to connect to Gmail’s SMTP server over SSL (port 465). Here’s a simplified version of what it runs:
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
gmail_address = 'yourname@gmail.com' # from secrets
gmail_app_password = 'abcd efgh ijkl mnop' # from secrets
msg = MIMEMultipart('alternative')
msg['Subject'] = 'Hello from Agent Zero!'
msg['From'] = gmail_address
msg['To'] = gmail_address
msg.attach(MIMEText('This email was sent by Agent Zero.', 'plain'))
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as server:
server.login(gmail_address, gmail_app_password)
server.sendmail(gmail_address, gmail_address, msg.as_string())
Agent Zero handles all of this for you — you just need the credentials in place.
What Can You Do With It?
Once email is set up, the possibilities are wide open:
| Use Cases | Description | Example Use Case |
| Birthday Reminders | Automatically tracks family and friend birthdays. | “Remind me two days before my mom’s birthday.” |
| Scheduled Reports | Delivers structured data or updates on a set frequency. | Receiving a daily 8:00 AM weather and task summary. |
| File Delivery | Attaches and sends various file formats (PDF, CSV, etc.). | Sending a generated expense report directly to your inbox. |
| Task Notifications | Sends an alert once a background process is finished. | Getting an email when a large data analysis is complete. |
| On-Demand Emails | Sends specific information instantly upon request. | “Email me the transcript of this meeting.” |
Troubleshooting
| Problem | Solution |
|---|---|
| “Secret placeholder not found” | Credentials haven’t been saved in Secrets Management yet |
| Authentication error | Make sure you’re using the App Password, not your regular Gmail password |
| App passwords option missing | 2-Step Verification must be enabled first |
| Email goes to spam | Add your own address to your contacts; this is normal for programmatic senders |
| Managed Google account | Organization policies may block App Passwords — check with your admin |
Summary
| Step | Action |
|---|---|
| 1 | Enable 2-Step Verification on Google |
| 2 | Create a Gmail App Password |
| 3 | Add credentials to Agent Zero’s Secrets Management |
| 4 | Ask Agent Zero to send a test email |
| 5 | Start automating! |
Written with Agent Zero — the AI that figures things out with you, not just for you.
