Strip quoted history and signatures from email replies — covers Gmail, Outlook, and mobile-client formats across English, Dutch, German, French, and Spanish.
Zero runtime dependencies. ESM only.
Parsing a messy human email reply — quoted history, "On ... wrote:" headers in five languages, Outlook dividers, mobile signatures — is a pain nobody should have to solve twice. Every mail client formats this stuff differently, and every locale phrases it differently. This package packages up that tuned parsing logic so you don't have to rebuild it from scratch.
npm install reply-clean
The function most people want: runs quote stripping, then signature stripping, then whitespace tidying, and returns the cleaned string.
import { cleanReply } from "reply-clean";
const body = `Thanks, that works for me!
On Mon, Jun 16 2026 at 09:00 AM <alice@example.com> wrote:
> Does Tuesday at 10am work?`;
cleanReply(body);
// => "Thanks, that works for me!"Removes quoted history: >-prefixed lines, "On ... wrote:" headers (and Dutch/German/French/Spanish equivalents), and Outlook-style dividers or From:/Van:/Von:/De: header blocks. Returns { text, removed }.
import { stripQuotes } from "reply-clean";
stripQuotes(
"Sounds good.\n\nOn Mon, Jun 16 2026 at 09:00 AM Example wrote:\n> previous"
);
// => { text: "Sounds good.", removed: true }Removes a trailing signature: the standard -- delimiter or a "Sent from my iPhone/Android/..." mobile footer. Returns { text, removed }.
import { stripSignature } from "reply-clean";
stripSignature("OK sounds good\nSent from my iPhone");
// => { text: "OK sounds good", removed: true }Collapses runs of 3+ newlines down to 2, trims trailing whitespace from line ends, and trims the whole string.
import { tidy } from "reply-clean";
tidy("a \n\n\n\nb");
// => "a\n\nb"reply-clean only cleans text. It does not detect sender intent, reconstruct email threads, or handle delivery — it takes a body string in and gives you a body string back.
This is the cleaning layer that also powers replyflow.com — a hosted inbound-email-webhook API that additionally adds intent detection, RFC-5322 thread reconstruction, and signed webhook delivery with automatic retries, so you don't have to run any of this yourself.
MIT © Dutchcode B.V.