Feature Guide · 9 min read · 2026-07-08
Custom Scan Builder: Create Your Own Gmail Cleanup Queries
Master the visual query builder to target exactly the emails you want to delete. Combine filters for sender, subject, size, date, labels, and more.
Beyond Presets: Surgical Precision for Your Inbox
While Smart Mailbox Cleaner's 7 Smart Categories cover 90% of common cleanup scenarios, every inbox has its own unique clutter.
Perhaps you are a software developer whose inbox is buried under 25,000 automated GitHub and Jira notification digests. Maybe you are a real estate agent with gigabytes of high-resolution property flyers from local MLS lists. Or perhaps you want to purge all e-commerce order updates older than two years while strictly preserving messages containing the word "Invoice."
In standard Gmail, constructing complex search queries requires memorizing cryptic operators, parentheses, and boolean logic. A single typo in an operator like older_than: or has:attachment can produce empty results or, worse, match emails you never intended to delete.
The Custom Scan Builder eliminates this friction with an intuitive visual query interface. It allows you to build sophisticated, multi-variable Gmail cleanup rules using simple dropdowns and sliders—generating live query previews and real-time email match estimates before you clean a single message.
How to Access the Custom Scan Builder
- Log in to your Smart Mailbox Cleaner dashboard.
- Navigate to the Scan tab on the left sidebar.
- Next to the primary Quick Scan button, click Custom Scan Builder.
- The visual query interface expands, presenting all filtering controls.
(Note: The Custom Scan Builder is a premium feature available on Pro and Power plans. Explore details on our Pricing Page).
Detailed Filter Breakdown
+-------------------------------------------------------------------------+
| CUSTOM SCAN BUILDER INTERFACE |
+-------------------------------------------------------------------------+
| Sender / Domain: [@linkedin.com ] [Match exact/domain] |
| Subject Keywords: [digest, notification ] [Exclude: "security"] |
| Date Range: [Older than 180 days ] |
| Size Boundary: [Larger than 5 MB ] |
| Gmail Labels: [Category: Social ] |
| Read Status: [Unread Only ] |
| Attachment Presence: [Has Attachment ] |
| |
| ───────────────────────────────────────────────────────────────────── |
| GENERATED GMAIL QUERY: |
| from:@linkedin.com category:social is:unread larger:5M older_than:180d |
| -in:trash -in:spam -is:starred |
| |
| ESTIMATED MATCHES: 1,840 emails | ESTIMATED FREED: 3.2 GB |
| [ Start Custom Scan ] [ Save as Playbook ] |
+-------------------------------------------------------------------------+
1. Sender and Domain Filter (from:)
Target specific senders or entire corporate domains:
- Exact Email:
newsletter@brand.com - Entire Domain:
@notifications.pinterest.com or @uber.com - Great For: Eradicating high-frequency automated senders in a single stroke.
2. Subject Keywords (subject:)
Match specific words or phrases in the email subject line:
- Include Keywords: Target terms like
daily digest, webinar recording, shipping update, or statement. - Exclude Keywords: Safeguard critical emails by adding negative operators, e.g.,
-subject:tax or -subject:receipt.
3. Size Boundaries (larger: / smaller:)
Filter messages based on total byte weight:
- Presets: Larger than 1MB, 5MB, 10MB, or 25MB.
- Custom Range: Combine
larger:5M smaller:15M to isolate medium-weight documents without touching massive video files.
4. Date Intervals (older_than: / newer_than:)
Define the age threshold for matching emails:
- Timeframes: 7 days, 30 days, 90 days, 6 months, 1 year, 2 years, or 3 years.
- Precision Targeting: Combine
older_than:1y newer_than:3y to target a specific historical window.
5. Label and Category Filtering (label: / category:)
Filter by Gmail's native categories or your own custom labels:
- System Tabs:
category:promotions, category:social, category:updates, category:forums. - Custom Labels: Target any custom folder you created in Gmail (e.g.,
label:OldProjects).
6. Read / Unread Status (is:read / is:unread)
- Unread Only: Find newsletters you subscribed to but never opened over the past year.
- Read Only: Clean out transactional receipts and shipping alerts that you have already reviewed.
7. Attachment Attributes (has:attachment / filename:)
- Filter for specific file extensions:
filename:pdf, filename:zip, filename:mp4, or filename:ics.
Built-In Safety Exclusions
To prevent catastrophic mistakes, the Custom Scan Builder automatically applies our Triple-Shield Exclusion to every generated query:
-in:trash: Excludes items already in Trash.-in:spam: Excludes spam items to prevent false positives.-is:starred: Automatically protects any email you explicitly marked with a star.
(You can override the starred exclusion in advanced settings if you explicitly intend to clean flagged items).
Mastering Boolean Logic (AND, OR, NOT) in the Query Interface
When tackling specialized mailbox sprawl, understanding how the Custom Scan Builder handles boolean logic ensures you construct watertight queries:
Implicit AND Logic
When you configure multiple fields in the builder—such as selecting a sender (@linkedin.com), an age threshold (older_than:90d), and a label (category:social)—the system combines these conditions using logical AND. The email must satisfy every single condition simultaneously to be matched.
Explicit OR Logic for Grouped Targets
If you want to clean multiple related senders or keywords in a single pass, you can use comma separation or explicit OR syntax inside the input fields:
- Multiple Senders: Typing
@uber.com, @lyft.com, @doordash.com in the Sender field translates to (from:@uber.com OR from:@lyft.com OR from:@doordash.com). - Subject Variations: Typing
receipt, invoice, billing statement in the Subject field matches any email containing at least one of those phrases.
The Negative (NOT) Exclusions
Protecting crucial threads requires the NOT operator (-). The builder provides dedicated exclusion inputs:
- Exclude messages containing specific words (e.g.,
-subject:tax -subject:w2). - Exclude designated client domains (e.g.,
-from:@partnercorp.com). - Exclude high-importance custom folders (e.g.,
-label:LegalArchive).
How Custom Scans Integrate with AI Confidence Scoring
Unlike raw command-line scripts or native Gmail filters that delete blindly, queries executed through the Custom Scan Builder pass through Smart Mailbox Cleaner's Confidence Scoring Engine.
Once the query resolves matching message headers, our engine inspects the metadata of each individual message:
- Did you reply to this thread recently? (Deducts 20 points).
- Is it marked as Important by Google's native algorithms? (Deducts 35 points).
- Is it an automated noreply address? (Adds 10 points).
Even within a custom search query matching 5,000 emails, our engine automatically groups the results into HIGH, MEDIUM, and REVIEW REQUIRED sub-tiers. You can execute cleanup on the HIGH tier with complete confidence while inspecting any borderline messages before taking action.
10 Battle-Tested Custom Query Recipes
Here are ten high-impact custom queries you can build inside the Custom Scan Builder:
| Goal | Generated Gmail Query |
|---|
| 1. Stale LinkedIn Alerts | from:@linkedin.com older_than:90d |
| 2. Heavy Obsolete PDFs | has:attachment filename:pdf larger:10M older_than:1y |
| 3. Unread Retail Newsletters | category:promotions is:unread older_than:60d |
| 4. Expired Zoom Recordings | subject:"recording" from:@zoom.us older_than:90d |
| 5. Old E-Commerce Shipping | subject:(shipped OR tracking OR delivery) older_than:1y |
| 6. GitHub Bot Notifications | from:notifications@github.com older_than:30d |
| 7. Large Sent Attachments | from:me has:attachment larger:10M older_than:2y |
| 8. Jira/Confluence Digests | from:@atlassian.net older_than:60d |
| 9. Old Calendar Invites | filename:invite.ics older_than:14d |
| 10. Stale Forum Updates | category:forums older_than:180d |
Turning a Custom Scan into an Automated Playbook
The true power of the Custom Scan Builder is automation. Once you have crafted and tested a custom query that successfully purges clutter:
- On the custom scan results screen, click Save as Playbook.
- Assign an execution frequency (e.g., Weekly or Monthly).
- Set your safety confidence threshold.
- From that moment forward, Smart Mailbox Cleaner will run your custom query in the background, keeping that specific clutter from ever piling up again.
Strict Metadata Privacy
In accordance with our strict privacy framework:
"We only access email metadata — sender, date, size, labels. We never read email content."
The Custom Scan Builder constructs queries executed via official Google API search endpoints. We analyze matched headers and counts without ingesting or storing email body content.
Master your email search today. Build your first custom query for free at Smart Mailbox Cleaner and upgrade to Pro on our Pricing Page.
Related Reading
Frequently Asked Questions
Can I test a custom query before deleting any emails?
Yes! When you construct a query in the Custom Scan Builder, the live preview displays an estimated email match count and estimated storage size. When you click "Start Custom Scan", the results are generated as a preview card allowing you to inspect individual messages before confirming cleanup.
Can custom scans accidentally delete my starred emails?
No. By default, the Custom Scan Builder automatically attaches the -is:starred safety operator to every generated query, ensuring that any email you marked with a star is protected from deletion.
What plan is required to access the Custom Scan Builder?
The Custom Scan Builder is a power feature included with Pro (₹349/month) and Power (₹699/month) plans. Free and Starter users can clean using the 7 pre-built Smart Scan categories.
Can I save my custom queries to run automatically every month?
Yes! After running a custom scan, you can click "Save as Playbook" to convert your query into an automated background routine that runs on a weekly, bi-weekly, or monthly schedule.
Can I target specific file attachment formats like video or audio?
Yes. You can use the filename filter in the builder to target specific extensions such as filename:mp4, filename:mov, filename:zip, or filename:pdf in combination with file size thresholds.
Try Smart Mailbox Cleaner free →