Skip to content
Writing
RFC 8058DeliverabilityComplianceReact Email

How to Implement RFC 8058 One-Click Unsubscribe Headers in React Email

Google and Yahoo require all bulk and notification senders to support RFC 8058 one-click unsubscribe. Here is how to configure HTTP POST handlers and headers in React Email.

Tayyab MughalFounder & AI Chief2 min read

Why RFC 8058 compliance is non-negotiable in 2026

Under sender requirements enforced by Gmail, Yahoo, and Apple Mail, messages sent without valid RFC 8058 headers risk immediate spam folder placement or domain throttling.

RFC 8058 requires two specific MIME headers in the email envelope and an HTTPS POST endpoint capable of processing the unsubscribe request without user interaction.

Required Email Headers

When sending notifications or digests via SadaSend, supply the required headers in the API payload:

JSON
{
  "to": "alex@customer.com",
  "subject": "Weekly AI Digest #42",
  "headers": {
    "List-Unsubscribe": "<https://sadasend.com/api/unsubscribe?token=jwt_token_here>, <mailto:unsubscribe@sadasend.com?subject=unsubscribe_jwt_token_here>",
    "List-Unsubscribe-Post": "List-Unsubscribe=One-Click"
  }
}

Next.js 15 RFC 8058 Unsubscribe Endpoint (app/api/unsubscribe/route.ts)

Googlebot and Yahoo mail servers will issue an HTTP POST request with a form-encoded payload containing List-Unsubscribe=One-Click. Your endpoint must accept POST and return 200 OK.

TYPESCRIPT
import { NextRequest, NextResponse } from 'next/server';

export async function POST(req: NextRequest) {
  const token = req.nextUrl.searchParams.get('token');
  const bodyText = await req.text();

  // Validate RFC 8058 body parameter
  if (!bodyText.includes('List-Unsubscribe=One-Click')) {
    return NextResponse.json({ error: 'Invalid RFC 8058 request body' }, { status: 400 });
  }

  // Update customer preference in database without requiring login
  console.log(`[RFC_8058] Unsubscribing token: ${token}`);
  // await db.users.update({ where: { token }, data: { unsubscribed: true } });

  return new NextResponse('Unsubscribed successfully', { status: 200 });
}
Early Access

Building AI agents that send email?

Join the SadaSend early access waitlist to get scoped API keys, recipient allowlists, and Model Context Protocol (MCP) servers upon launch.

Rolling out in developer batches·No credit card needed
Social Hashtags & Share
#EmailAPI#DeveloperTools#RFC8058#EmailDeliverability#DKIM#DMARC
Tayyab MughalFounder & AI Chief

Building SadaSend — transactional email with an MCP server that has a ceiling. Writes about deliverability, email infrastructure, and what happens when you hand an autonomous agent a sending credential.

Keep reading