|

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 

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.

  1. Go to myaccount.google.com
  2. Click Security in the left sidebar
  3. Under “How you sign in to Google”, click 2-Step Verification
  4. 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.

  1. Go back to Security in your Google Account
  2. Click 2-Step Verification again
  3. Scroll to the bottom and click App passwords
  4. In the App name field, type something like Agent Zero
  5. Click Create
  6. 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.

  1. Open the Agent Zero web UI
  2. Click the ⚙️ Settings icon
  3. Navigate to External Services
  4. Scroll to the Secrets Management section
  5. Add your credentials in KEY=VALUE format, one per line:
GMAIL_ADDRESS=yourname@gmail.com
GMAIL_APP_PASSWORD=abcd efgh ijkl mnop 
  1. 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 at usr/projects/<project-name>/.a0proj/secrets.env that 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 CasesDescriptionExample Use Case
Birthday RemindersAutomatically tracks family and friend birthdays.“Remind me two days before my mom’s birthday.”
Scheduled ReportsDelivers structured data or updates on a set frequency.Receiving a daily 8:00 AM weather and task summary.
File DeliveryAttaches and sends various file formats (PDF, CSV, etc.).Sending a generated expense report directly to your inbox.
Task NotificationsSends an alert once a background process is finished.Getting an email when a large data analysis is complete.
On-Demand EmailsSends specific information instantly upon request.“Email me the transcript of this meeting.”

Troubleshooting

ProblemSolution
“Secret placeholder not found”Credentials haven’t been saved in Secrets Management yet
Authentication errorMake sure you’re using the App Password, not your regular Gmail password
App passwords option missing2-Step Verification must be enabled first
Email goes to spamAdd your own address to your contacts; this is normal for programmatic senders
Managed Google accountOrganization policies may block App Passwords — check with your admin

Summary

StepAction
1Enable 2-Step Verification on Google
2Create a Gmail App Password
3Add credentials to Agent Zero’s Secrets Management
4Ask Agent Zero to send a test email
5Start automating!

Written with Agent Zero — the AI that figures things out with you, not just for you.


Disclaimer:  I work for Dell Technology Services as a Workforce Transformation Solutions Principal.    It is my passion to help guide organizations through the current technology transition specifically as it relates to Workforce Transformation.  Visit Dell Technologies site for more information.  Opinions are my own and not the views of my employer.