Skip to content

dutchcode/reply-clean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reply-clean

tests

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.

Why this exists

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.

Install

npm install reply-clean

Usage

cleanReply(body)

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!"

stripQuotes(body)

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 }

stripSignature(body)

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 }

tidy(text)

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"

What it does not do

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.

Also powers replyflow.com

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.

License

MIT © Dutchcode B.V.

About

Strip quoted history and signatures from email replies — covers Gmail, Outlook, and mobile-client formats across English, Dutch, German, French, and Spanish.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors