Advanced Automation · 9 min read · 2026-05-14
Delete Emails from Specific Sender with No Attachments Older Than 30 Days
Preserve files while deleting text. Learn how to delete old text-only emails from a specific person while keeping emails that contain attachments.
The Conversational Chatter Dilemma
When you collaborate closely with contractors, colleagues, clients, or vendors, your email thread history often splits into two vastly different categories:
- High-Value Deliverables: Messages containing vital project files, signed PDF contracts, design assets, invoices, or spreadsheet deliverables. You need to keep these attachments permanently.
- Everyday Conversational Chatter: Hundreds of short, text-only emails containing messages like "Sounds good", "See you at 3", "On it", "Thanks!", or "Got it".
During an active project, quick conversational exchanges are helpful. But six months later, maintaining hundreds of pages of one-line text banter creates massive digital clutter, bloats your search queries, and makes finding actual deliverable files excruciatingly slow.
The ideal solution is simple: delete the text-only conversational chatter once it ages out, while creating an ironclad protective shield around every email containing an attachment.
In this guide, we show you how to execute this negative-attachment query in native Gmail, and how to configure an automated Playbook using Smart Mailbox Cleaner.
The Manual Way: Gmail Search Operators for Negative Attachment Logic
To target text-only emails while protecting files, you must use Gmail's negative operator prefix (-).
1. The Negative Attachment Query
In the Gmail search box, enter:
from:colleague@company.com -has:attachment older_than:30d
Let's examine how each operator contributes to this query:
from:colleague@company.com: Restricts the search strictly to this specific contact or collaborator.-has:attachment: The hyphen represents a logical NOT. This operator instructs Gmail to exclude any conversation that contains a file attachment, image, or document.older_than:30d: Preserves recent conversational context from the past 30 days, ensuring that active project dialogue is never disrupted.
2. Adding Starred and Important Exclusions
To guarantee that important text-only emails (such as a password hint or crucial meeting note) are protected, append exclusion operators:
from:colleague@company.com -has:attachment older_than:30d -is:starred -label:important
3. Understanding How Gmail Evaluates Attachments
When using negative attachment logic in Gmail, keep these technical details in mind:
- Google Drive Links: If your collaborator shared a Google Drive link or Dropbox URL inside the body of an email, Gmail treats this as body text, not as a MIME attachment. If you want to protect emails containing Drive links, add an exclusion:
-("drive.google.com" OR "docs.google.com"). - Embedded Signature Images: Small company logo images in email signatures can sometimes be flagged by Gmail as attachments depending on how the sender's client formatted them. In Smart Mailbox Cleaner, our scanning engine checks MIME structure to ensure signature icons do not cause misclassification.
4. Executing the Manual Deletion
- Press Enter to run the search in Gmail.
- Select the checkbox at the top-left of the message view.
- Click the blue link: "Select all conversations that match this search".
- Click the Trash icon.
The Smart Way: Custom Scan Builder Step-by-Step Configuration
Smart Mailbox Cleaner turns negative-attachment filtering into a reliable, automated Playbook.
Step-by-Step Query Setup in Custom Scan Builder
Follow these exact steps to configure your scan:
Step 1: Open Custom Scan Builder
Sign in to your Smart Mailbox Cleaner Dashboard and navigate to the Custom Scan Builder.
Step 2: Configure the Sender Field
- In the Sender field, enter your collaborator's email address:
colleague@company.com (or target an entire team domain like @agency.com).
Step 3: Configure Negative Attachment Filtering
- Locate the Has Attachment parameter.
- Explicitly set the toggle to "No" (or
Attachment: None). This creates an unbreakable filter that completely ignores any message carrying an attached file.
Step 4: Set the Age Parameter
- In the Date / Age selector, choose "Older than 30 Days" (or 60/90 days).
Step 5: Enable Safety Protections
- Under Protections, ensure "Exclude Starred" is toggled ON. Any text email you marked with a star will remain permanently safe.
Step 6: Review Live Exact Metrics in Preview
Check the real-time calculation panel on the right side of the screen:
- Target Match Count: Displays the exact count of text-only emails (e.g.,
418 conversations). - Protected Deliverables: Our panel confirms that all emails containing file attachments from this sender are excluded from the deletion batch.
- Click "Expand Preview" to inspect the matching subject lines and verify that only text chatter is selected.
Step 7: Save as an Automated Playbook
Click "Save as Playbook":
- Name: "Auto-Prune Text Chatter: [Sender Name]".
- Schedule: Set to Run Monthly (1st of every month).
- Click "Activate Playbook".
How the Playbook Operates on Autopilot
With this Playbook active:
- On the 1st of every month, Smart Mailbox Cleaner executes the query via server-side API calls.
- Any text-only email from that sender that has crossed the 30-day mark is automatically moved to Trash.
- Every single email containing an attachment (PDF, spreadsheet, image, archive) is permanently preserved in your account.
- Your message search results become clean and fast, allowing you to locate actual deliverables in seconds.
Native Gmail Filters vs. Smart Mailbox Cleaner Playbooks
| Feature | Native Gmail Filters | Smart Mailbox Cleaner Playbook |
|---|
| Negative Attachment Logic | Supported via -has:attachment | Supported via visual toggle in Custom Scan Builder |
| Dynamic Age Buffer | Impossible (Cannot schedule dynamic dates) | Fully supported (Rolling 30, 60, or 90 day windows) |
| Drive Link Detection | Requires manual search string | Integrated link detection safety guards |
| Undo Safety | Messy Trash restoration | 1-Click 30-Day Undo with label preservation |
| Multi-Account Deployment | Must repeat manually in each inbox | Deploy across up to 5 accounts with 1 click |
Complete Safety and 30-Day Undo
We know that pruning conversational threads requires total peace of mind:
- Metadata-Only Processing: We only access email metadata — sender, date, size, labels. We never read email content. We never access message bodies or private correspondence.
- 30-Day Undo Guarantee: If an automated Playbook ever purges a text conversation containing an important address or phone number, visit your History Dashboard and click Undo. The entire batch is restored to its original Gmail folders with all labels intact.
- Transparent Pricing: Test your query — first cleanup free, or choose Starter (₹149/mo), Pro (₹349/mo), or Power (₹699/mo) on our Pricing Page.
Keep the files, trash the chatter. Build your negative-attachment Playbook today on Smart Mailbox Cleaner.
Related Reading
Frequently Asked Questions
How does the negative attachment filter (-has:attachment) work in practice?
The negative operator instructs the query engine to exclude any email conversation where an attachment MIME part is present. Only conversations with zero attached files will be returned.
Will this rule delete emails where the sender shared a Google Drive or Dropbox link?
Because Google Drive links are text URLs inside the email body rather than MIME attachments, native Gmail treats them as text-only emails. In Smart Mailbox Cleaner, you can add an exclusion rule to protect emails containing Drive URLs.
Can I apply this rule to an entire team or domain rather than a single email address?
Yes. In the Custom Scan Builder, simply enter "@agency.com" or "@clientdomain.com" in the Sender field. The Playbook will evaluate all senders from that domain.
Does an email signature image count as an attachment in Gmail?
In native Gmail, inline signature images can sometimes be misclassified as attachments. Smart Mailbox Cleaner evaluates MIME header metadata to distinguish between genuine file attachments and lightweight inline signature icons.
If I starred an important text-only email from this sender, will it be protected?
Yes. In both native Gmail (using -is:starred) and Smart Mailbox Cleaner (via the Exclude Starred toggle), any email you marked with a star is completely excluded from deletion.
Try Smart Mailbox Cleaner free →