Recipient Check

Reduces misaddressed email by flagging external recipients, lookalike or typo'd domains, duplicates and names paired with the wrong address.

StopsEmail sent to the wrong address

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/recipient-check.json

The files land in your project. They're yours to edit.

Usage

recipient-check-usage.tsx
import { RecipientCheck, type Recipient } from "@/components/ui/recipient-check"

<RecipientCheck
  label="To"
  value={recipients}
  onValueChange={setRecipients}
  internalDomains={["acme.com"]}
  contacts={contacts}
  warnAt={25}
/>

What it catches

  • Recipients outside your internal domains
  • Typo'd consumer domains (gmial.com → gmail.com) with a one-tap fix
  • Duplicate addresses
  • A known contact's name paired with a different address
  • More recipients than warnAt, with a one-tap remove-externals

Props

RecipientCheck props
PropTypeDefault
value

Recipients (controlled).

Recipient[]—
defaultValue

Starting recipients when uncontrolled.

Recipient[][]
onValueChange

Called with the full recipient list after every change.

(value: Recipient[]) => void—
internalDomains* (required)

Your organisation's domains. Everyone else is marked external.

string[]—
contacts

Known people, used to catch a name paired with the wrong address.

Required<Recipient>[][]
warnAt

Warn when the message goes to more people than this.

number25
label

Field label, e.g. "To" or "Cc".

string"To"
placeholder

Placeholder while the field is empty.

string"name@company.com"
messages

Override any user-visible string (see `RECIPIENT_MESSAGES`).

Partial<RecipientMessages>—
inputRef

Ref to the text input, e.g. to focus it.

React.Ref<HTMLInputElement>—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible <label> tied to the input; aria-invalid when any recipient has an error
  • Enter, comma, semicolon or Tab commits an address; Backspace on an empty field arms then removes the last chip
  • Chip issues are spoken through sr-only text; each remove button has an aria-label
  • Warnings and fixes render in a polite live region; icons are aria-hidden
  • Undo after a bulk remove

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Typo detection uses edit distance against a built-in list and your domains; unusual domains can be missed or wrongly flagged
  • Does not check that a mailbox exists
  • Name/address mismatch only works for people in contacts

What it stops

Email sent to the wrong address

Also known as

recipients · to field · email · autocomplete · external · typo domain · gmail · compose

Field type

Dependencies

Pairs well with