Skip to content

Collects as they arrive, acts daily

Collect unsubscribes and bounces for your list

Unsubscribe requests and bounced emails are labelled, and you get the addresses once a day to clean your list.

Runs
Collects as they arrive, acts daily
Apps
Gmail
AI
Not needed
Access
read+write (gmail.modify)

Send this to your assistant

Create a ClickRuntime automation: every hour, find unsubscribe requests and bounce messages in my inbox and label them. Once a day, email me the addresses.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

If you send newsletters or cold outreach from Gmail, the replies include two kinds of mail that quietly damage your reputation if ignored: people asking to be removed and delivery failure notices from addresses that no longer exist. Left in the inbox, you email the same unhappy person again, and repeated bounces teach providers to treat your domain as a spammer, so real messages land in junk.

As messages arrive, searches look for bounce and unsubscribe patterns, addresses are pulled out of them and a label is applied in Gmail. Once a day you receive a single email listing the addresses collected, ready to remove from your mailing list or spreadsheet in one go.

Small marketers, consultants running outreach and anyone who sends from their own mailbox rather than a dedicated platform will find it useful.

What you get out of it

  • Your sender reputation is protected

    Removing bad addresses promptly lowers your bounce rate, which is one of the main signals providers use to decide whether your mail goes to the inbox or to spam. Deliverability is hard to repair once it has been damaged.

  • People who opted out stay opted out

    Emailing someone again after they asked to stop causes complaints and can break privacy rules, so a reliable list of requests is simple protection. Respecting requests is also simply good practice.

  • Cleanup takes minutes

    A daily list of addresses to remove replaces scrolling through hundreds of automatic replies, which is the kind of chore most senders skip until a problem appears. Regular upkeep beats a rare and painful purge.

  • Everything is labeled for your reference

    Labels in Gmail group the bounce and unsubscribe messages, so you can audit what was received if a recipient later disputes that they asked to be removed. Records matter when a complaint arrives weeks later.

  • The inbox stays usable

    Moving the noise under labels keeps real replies from customers and prospects visible, so genuine conversations are not hidden behind failure notices. Real customer replies become easier to notice and answer promptly.

How it works

What happens, step by step

  1. Every hour ClickRuntime searches your Gmail for unsubscribe requests and bounced-email notices.

  2. It pulls out the email addresses involved and labels the messages so they aren't counted twice.

  3. Once a day you get an email listing every address that unsubscribed or bounced, ready to remove from your mailing list.

Before it runs live

  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
  • Paste your automation's link into the other app's webhook settings

What you get

RunsCollects as they arrive, acts daily
Collect unsubscribes and bounces for your listtoday, 9:00Succeeded
Email · 4 unsubscribes and bouncesjo@acme.example old-address@northwind.example

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • 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

  • Act only on the items that match your own rules, and skip the rest
  • 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

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
handle_unsubscribe_and_bounce_emails.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import re
from datetime import datetime
from zoneinfo import ZoneInfo
from clickruntime import on_trigger, credentials, state, notify

QUERY = 'newer_than:1d (subject:unsubscribe OR from:mailer-daemon OR subject:"delivery status notification")'
EMAIL = re.compile(r"[\w.+-]+@[\w-]+\.[\w.]+")

@on_trigger
def run(event):
    gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    labels = {l["name"]: l["id"] for l in gmail.users().labels().list(userId="me").execute()["labels"]}
    label = labels.get("Unsub-Bounce") or gmail.users().labels().create(userId="me", body={"name": "Unsub-Bounce"}).execute()["id"]
    pending = set(state.get("pending") or [])
    msgs = gmail.users().messages().list(userId="me", q=QUERY + " -label:Unsub-Bounce").execute().get("messages", [])
    for m in msgs:
        msg = gmail.users().messages().get(userId="me", id=m["id"], format="metadata", metadataHeaders=["From"]).execute()
        sender = next(h["value"] for h in msg["payload"]["headers"] if h["name"] == "From")
        source = msg["snippet"] if "mailer-daemon" in sender.lower() else sender
        pending.update(a.lower() for a in EMAIL.findall(source) if "mailer-daemon" not in a.lower())
        gmail.users().messages().modify(userId="me", id=m["id"], body={"addLabelIds": [label]}).execute()
    if datetime.now(ZoneInfo("Europe/London")).hour == 17 and pending:  # once a day
        notify.email_me(f"{len(pending)} unsubscribes and bounces", "\n".join(sorted(pending)))
        pending = set()
    state.set("pending", sorted(pending))
    return {"labelled": len(msgs)}

FAQ

Common questions

What counts as an unsubscribe request?
Messages containing phrases such as unsubscribe, remove me or stop emailing me, plus replies to an unsubscribe address. Because wording varies, the patterns can be extended as you see new phrasings in your own mail.
How are bounces recognized?
By their usual markers, including messages from mailer-daemon and subjects like Delivery Status Notification or Undeliverable. The failing address is pulled from the notice, so you remove the address that failed. Delivery reports sometimes use other wording too.
Does it remove people from my mailing list?
No. It collects and labels the addresses and emails you the list each day. Removing them from your list or sending tool stays a deliberate step on your side, so nothing is deleted by mistake.
What permissions does it need?
read+write (gmail.modify). Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Collect unsubscribes and bounces for your list” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.