Daily
Clean up your inbox every night
Old promotions, social mail and spam go to trash and read mail is archived, so your inbox only holds what's current.
- Runs
- Daily
- Apps
- Gmail
- AI
- Not needed
- Access
- read+write (gmail.modify)
Send this to your assistant
Create a ClickRuntime automation: every night, move emails in Spam, Promotions and Social older than 7 days to trash, archive inbox emails older than a day unless they're starred, and email me how many were moved.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An inbox that is never cleaned becomes a liability. Tens of thousands of old promotions, social notifications and read mail make search slower and storage fuller, and the emails that matter are harder to spot. People plan to spend a Sunday clearing it, never do, and the number just keeps climbing. Gmail's storage limit then becomes a surprise bill or a blocked inbox.
Each day, searches by category and age find mail that does not need to stay: Spam, Promotions, Social and old messages that you have already read. A batch operation removes them from the inbox or moves them to trash, and you receive an email with the count, so you know what was done.
Anyone with an old, crowded Gmail account, and especially people close to their storage quota, will notice the difference.
What you get out of it
Storage pressure goes away
Clearing bulk mail regularly keeps you under the Gmail quota, which avoids paying for extra space or suddenly being unable to receive messages. Those savings are most welcome for people on a free account.
Search gets faster and cleaner
With old promotions gone, results show real conversations, so finding an invoice or a thread from last year no longer means filtering through noise. You find what you need in a few seconds instead of a few minutes.
Cleanup happens in small daily steps
A few messages removed each day never turns into a giant job, and you never reach the point where cleaning feels impossible. Tiny daily steps are easy for the system to repeat without any fuss at all.
The count keeps you informed
A daily email with the number of messages cleared tells you that the process is running and would reveal a sudden jump caused by a change in your mail flow.
Important mail stays untouched
Searches use categories and age, and read status, so conversations with people and recent unread mail are left alone. Rules based on age and category keep the process predictable and safe.
How it works
What happens, step by step
Every night ClickRuntime searches your Gmail for the kinds of mail you no longer need, such as old promotions and social updates.
Matching emails are moved to the trash or archived out of your inbox, following the rules you set.
Your important mail is left where it is.
You get a short email saying how many messages were trashed and how many were archived.
Before it runs live
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Gmail steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, notify
def ids(gmail, q):
out, token = [], None
while True:
page = gmail.users().messages().list(userId="me", q=q, maxResults=500, pageToken=token).execute()
out += [m["id"] for m in page.get("messages", [])]
token = page.get("nextPageToken")
if not token:
return out
@on_trigger
def run(event):
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
trash = ids(gmail, "{in:spam category:promotions category:social} older_than:7d")
archive = ids(gmail, "in:inbox older_than:1d -is:starred")
for i in range(0, len(trash), 1000):
gmail.users().messages().batchModify(userId="me", body={"ids": trash[i:i + 1000], "addLabelIds": ["TRASH"]}).execute()
for i in range(0, len(archive), 1000):
gmail.users().messages().batchModify(userId="me", body={"ids": archive[i:i + 1000], "removeLabelIds": ["INBOX"]}).execute()
notify.email_me("Inbox clean-up", f"Moved {len(trash)} emails to trash and archived {len(archive)}.")
return {"trashed": len(trash), "archived": len(archive)}FAQ
Common questions
Does it permanently delete my emails?
Which mail is touched?
Can I protect specific senders?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a weekly list of attachments you received
Each week you get every attachment you received, grouped by sender, so you can find files fast.
See how it worksGet an inbox summary twice a day
Twice a day you get one email listing what came in and what you need to act on.
See how it worksSend yourself a weekly newsletter from your feeds
Once a week your own newsletter arrives with the best posts from the blogs and sites you follow.
See how it worksKeep exploring
Set up “Clean up your inbox every night” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.