Connect Mail to Custom Agents
The Mail connection brings your inbox directly into Custom Agent workflows. Once connected, an Agent can triage incoming messages, apply labels, draft replies, send emails, and automate repetitive inbox tasks — either on a trigger or through a direct chat instruction.
Mail connections work with Gmail and Closot Mail. Using Closot Mail is not required to use Mail connection capabilities — Gmail alone is fully supported.
What Your Custom Agent Can Do with Mail
The following actions are supported for both Closot Mail and Gmail:
| Action | Description |
|---|---|
| Search | Find specific emails in your inbox using keywords, sender, or other criteria |
| Archive | Move emails out of the inbox to keep it clean |
| Star | Mark important emails for easy retrieval |
| Trash | Delete unwanted emails |
| Manage labels | Create, apply, or remove email labels |
| Unsubscribe | Opt out of mailing lists automatically |
| Block and unblock sender | Block or unblock specific email addresses |
| Write | Draft new emails or replies |
| Send | Send emails directly from your account |
| Manage filters | Create and list email filters through Agent chat |
Closot Mail-Only Actions
The following actions are only available when using Closot Mail:
| Action | Description |
|---|---|
| Manage email status | Update triage state and status labels in Closot Mail |
| Set reminder | Create a follow-up reminder on a specific email |
| Create mail block in Closot | Save emails as synced blocks in your Closot workspace |
How to Connect Mail to Your Custom Agent
- Chat with your Agent and give it clear direction on how to handle mail. (Alternatively, connect manually via the Agent's Settings → Tools & Access → + Add connection → Mail → Connect.)
- Go to Settings → Tools & Access
- Select the inboxes you want your Agent to have access to
- Grant the permissions your Agent needs: Modify inbox, Draft, and/or Send
- Choose whether the Agent should Require confirmation before executing any action
- Test the connection — if the behavior isn't right, chat with the Agent to refine its instructions
Be as specific as possible. Instead of "manage my inbox," try: "Archive all newsletters with 'weekly digest' in the subject line" or "When I receive an email from a new client, draft a welcome reply and save it as a draft for my review."
Mail Triggers in Custom Agent
Add an email-based trigger from your Custom Agent's Settings.
- Go to Triggers → + Add trigger → Mail → Connect
- Choose from the following trigger types:
- New email received — Fires when a new message arrives in the connected mailbox
- New email sent — Fires when you send a message from the connected mailbox
- New email received or sent — Fires on both incoming and outgoing mail
- Label applied to email — Fires when a specific label is applied to a message
- Select the Inbox the trigger should monitor
- Optionally add a filter to narrow which emails activate the trigger — each trigger can be filtered by From, To, Subject, Body, or Domain
Mail Permissions in Custom Agent
When connecting Mail, you choose exactly what the Agent is allowed to do:
| Permission | What it allows |
|---|---|
| Modify inbox | Archive, trash, apply labels, set reminders, block senders, and unsubscribe |
| Draft | Create email drafts without sending |
| Send | Send emails directly from your account |
| Require confirmation | User must approve or cancel every action before it executes. Toggle off to let the Agent act without prompting. |
Use a combination of specific permissions and trigger filters (for example, "only run when a label is applied") to restrict which emails the Agent processes and prevent unintended actions.
Sharing Custom Agents with Mail Connections
If you share a Custom Agent that has a Mail connection, anyone with Can view and interact access to that Agent can view emails in the connected inbox. A warning is shown before sharing to make this clear.
Review exactly which inboxes are connected and who you're sharing with before granting team access to a Mail-connected Agent.
Example Instructions for Custom Agents
Here are four practical setups you can adapt as direct Agent instructions.
Inbox Organizer
Automatically sort and triage every incoming message so your inbox stays clean and actionable without any manual effort.
Tell your Agent: "When I receive an email, check whether it's a newsletter or marketing message. If yes, apply the 'Newsletter' label and archive it. If it's from a customer, star it and apply the 'Customer' label."
Inbox Cleanup Assistant
Continuously prune subscriptions and promotional clutter without you having to do it manually.
Tell your Agent: "Review my inbox for subscription-based emails. Unsubscribe me from any newsletters I haven't opened in the past 30 days, then archive those messages."
Email-to-Database Sync
Automatically capture new contacts from incoming email and create records in your Closot CRM database.
Tell your Agent: "When I receive an email from a new contact not already in my CRM database, create a new page in that database with their name, email address, company, and a link back to the original email."
Auto-Reply Draft Assistant
Generate ready-to-send draft replies for common incoming requests so you can review and send with one click.
Tell your Agent: "When I receive an email asking about pricing or availability, draft a professional reply with our standard response and save it as a draft for me to review before sending."
Troubleshooting
If your Agent encounters errors, use the thumbs-down feedback in the run, then chat with the Agent to diagnose. Then try the following:
Connection Errors
Symptom: Can't find Mail in Tools & Access, the Mail connection dropped unexpectedly, or the Agent says it can't access email.
- Confirm the Agent is connected to the correct email account in Tools & Access
- Verify you have Can edit or Full access permissions on the Agent
- Disconnect and reconnect the Mail connection, then refresh Closot
Trigger Errors
Symptom: The Agent isn't running when email is received, is running multiple times per message, or can't access email content.
- Open the Activity tab to confirm whether the trigger is firing vs. firing but failing
- Verify the Mail connection is still active in Tools & Access
- For label-based triggers, confirm the label name in the trigger configuration matches the label name exactly as it appears in your email client