All free prompts
Email about 30 minutes

Add one-click unsubscribe to marketing email

Every marketing email gets a working unsubscribe link and the List-Unsubscribe headers Gmail and Yahoo require.

Skip to the prompt

Who needs this

  • You send newsletters, product updates, promotions or any other email that isn't strictly transactional.
  • You send to Gmail or Yahoo addresses in volume (which is almost everyone).

Why it matters

  • In the US, CAN-SPAM requires a clear way to opt out, honoured within 10 business days, and a valid postal address in every commercial email. Canada's CASL and the UK's PECR also require a working unsubscribe in every marketing message.
  • Since 2024, Gmail and Yahoo require bulk senders to support one-click unsubscribe through the List-Unsubscribe and List-Unsubscribe-Post headers, to process unsubscribes within two days, and to authenticate mail with SPF, DKIM and DMARC. Senders who don't comply see their mail go to spam or be rejected.
  • Making unsubscribing hard pushes people to press 'Report spam' instead, which hurts every email you send, including password resets.

Before you paste

  • Which emails are marketing and which are transactional (receipts, password resets and security alerts are transactional).
  • Your email provider (Resend, Postmark, SendGrid, Kit, Loops or similar) and whether it adds unsubscribe headers for you.
  • Your business's postal address, if you send to US recipients.

The prompt

Copy it into your AI builder. Fill in anything in [brackets] first, and review every change before you ship it.

Prompt · paste into Lovable, Cursor, Claude Code or any AI builder
Make unsubscribing work properly for every marketing email this app sends. Transactional email (receipts, password resets, security alerts) is out of scope and must keep working for unsubscribed people.

1. CLASSIFY
List every email the app sends and mark it marketing or transactional. Anything promoting a product, offer or newsletter is marketing.

2. LINK IN EVERY MARKETING EMAIL
- A visible "Unsubscribe" link in the footer, plus the sender's business name and postal address.
- The link carries a signed token (HMAC of the email or user id) so it can't be guessed or used to unsubscribe someone else.

3. HEADERS
- Add List-Unsubscribe with an https URL (and a mailto address if the provider supports it).
- Add List-Unsubscribe-Post: List-Unsubscribe=One-Click.
- If the email provider can add these itself, use its built-in feature instead and confirm it's on.

4. THE UNSUBSCRIBE ENDPOINT
- POST (what mail apps send for one-click): unsubscribe immediately, no login, return 200.
- GET (a person clicking the link): show a page with one "Unsubscribe" button. Don't unsubscribe on GET, because email security scanners open links automatically.
- Offer choices only after the unsubscribe (for example "Get monthly updates instead"), never as a hurdle before it.

5. RECORD AND RESPECT IT
- Store the opt-out with a timestamp, and check it before every marketing send. Sync it to the email provider's suppression list if you use one.
- Process it immediately; never later than 2 days.

6. AUTHENTICATION
- Check the sending domain has SPF, DKIM and a DMARC record, and tell me what's missing.

When you're done: list every file you changed, explain each change in one line, and give me a step-by-step test for each numbered item above. Don't change anything unrelated.

Builder tips

Cursor

@-mention your email templates folder and the file that calls the email provider, so it adds headers in one place for all marketing sends.

Claude Code

Ask it to print the raw headers of a test email from the provider's dashboard to confirm List-Unsubscribe is really there.

Lovable

Paste it in Chat mode first, so Lovable explains its plan without changing code. When the plan looks right, ask it to implement.

Common mistakes

  • Unsubscribing on GET, so security scanners unsubscribe people who never clicked.
  • Requiring a login or a reason before unsubscribing.
  • Unsubscribing from one list while other marketing keeps arriving.
  • Blocking transactional email for unsubscribed users, which breaks password resets.

Check it worked

  1. 1Send yourself a marketing email at a Gmail address: Gmail shows its own Unsubscribe link next to the sender name.
  2. 2In Gmail, open the message's menu → Show original: the headers include List-Unsubscribe and List-Unsubscribe-Post, and SPF, DKIM and DMARC show PASS.
  3. 3Click the footer link: one confirmation step, then you're unsubscribed.
  4. 4Trigger the next campaign: you don't receive it, but a password reset still arrives.

What a SafeLaunch scan adds

SafeLaunch reads your email code and templates and checks unsubscribe, sender identity and consent against each market's marketing rules.

One free fix in your inbox each week

A new copy-paste prompt for Lovable, Cursor or Claude Code every week, with the rule behind it and how to check it worked. No spam, unsubscribe in one click.

By signing up you agree to get this weekly email. We send it with Kit, and you can unsubscribe at any time. What we share with Kit is in our privacy notice.

Questions

Most newsletter tools (Kit, Loops, Mailchimp and others) add the link and headers automatically. The risk is in emails your own app sends through a transactional provider, where you have to add them yourself.

If its main purpose is to promote features, offers or the product, treat it as marketing. If it's about the person's account or a transaction they made, it's transactional.

Sources

General guidance for common problems, not legal advice. Whether a rule applies depends on where you operate, who your users are and the size of your business.

More free prompts

Not sure which of these your app needs?

These prompts fix common problems. A SafeLaunch scan finds the ones your app actually has, across 54 markets, with the law behind each and the exact change for your code. Your first scans are free.

Get my free score