Skip to main content

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:

ActionDescription
SearchFind specific emails in your inbox using keywords, sender, or other criteria
ArchiveMove emails out of the inbox to keep it clean
StarMark important emails for easy retrieval
TrashDelete unwanted emails
Manage labelsCreate, apply, or remove email labels
UnsubscribeOpt out of mailing lists automatically
Block and unblock senderBlock or unblock specific email addresses
WriteDraft new emails or replies
SendSend emails directly from your account
Manage filtersCreate and list email filters through Agent chat

Closot Mail-Only Actions

The following actions are only available when using Closot Mail:

ActionDescription
Manage email statusUpdate triage state and status labels in Closot Mail
Set reminderCreate a follow-up reminder on a specific email
Create mail block in ClosotSave emails as synced blocks in your Closot workspace

How to Connect Mail to Your Custom Agent

  1. Chat with your Agent and give it clear direction on how to handle mail. (Alternatively, connect manually via the Agent's SettingsTools & Access+ Add connectionMailConnect.)
  2. Go to SettingsTools & Access
  3. Select the inboxes you want your Agent to have access to
  4. Grant the permissions your Agent needs: Modify inbox, Draft, and/or Send
  5. Choose whether the Agent should Require confirmation before executing any action
  6. Test the connection — if the behavior isn't right, chat with the Agent to refine its instructions
tip

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.

  1. Go to Triggers+ Add triggerMailConnect
  2. 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
  3. Select the Inbox the trigger should monitor
  4. 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:

PermissionWhat it allows
Modify inboxArchive, trash, apply labels, set reminders, block senders, and unsubscribe
DraftCreate email drafts without sending
SendSend emails directly from your account
Require confirmationUser must approve or cancel every action before it executes. Toggle off to let the Agent act without prompting.
tip

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

FAQs