# Mail sounds

Every account starts with mail sounds enabled. Open the speaker button in the mailbox header or **Account & files → Your account → Mail sounds** to mute sounds or preview either cue. The choice is saved for that account in the current browser and shared with its other tabs.

- Received: an original ascending chime followed by “You've got mail!”
- Sent: an original short air whoosh after the provider accepts a composed message or reply, including mail sent by CLAWD's automatic responder. Manual sends play immediately and their sent copies never cause another sound during polling. A failed send stays silent; the delivery notice still distinguishes queued, delivered, and bounced recipients.

While CLAWD Mail is open, authenticated users' owned inboxes are checked every 15 seconds (30 seconds in a background tab; browsers may throttle background tabs further). Mail received or sent in another owned inbox also alerts. New mail in the active inbox refreshes its conversation list and reader without discarding an unsent reply. A batch arriving between checks plays one cue per direction, queued to avoid overlapping speech and whooshes. The first successful snapshot is silent so signing in, reloading, restoring old mail, and switching folders cannot replay historical mail. Sent messages and agent replies do not produce received alerts. Signing out, expired sessions, and revoked approval stop the monitor; failed reads retry with backoff. Tabs coordinate alerts through Web Locks and local storage when available.

Browser autoplay rules require a click, tap, or keypress to unlock audio after reopening the app. Blocked or unavailable audio cannot fail a send or prevent mail from loading. These are in-app sounds; a closed app cannot play custom sounds. No system notification permission is needed.

The bundled MP3s live in `public/sounds/` and are copied into `dist/sounds/` during builds. `scripts/generate-mail-sounds.py` renders the chime and whoosh from mathematical synthesis and speaks the phrase with the local macOS Samantha voice; it uses no third-party recording or remote audio service. Regenerate with `npm run sounds:generate` on macOS with FFmpeg installed. Playback needs neither tool nor speech synthesis on the user's device.

`npm run verify:sounds` exercises decoded audio playback and received/send/reply behavior in a fixture browser without contacting email providers. Backend ownership tests cover authentication, approval, private inbox scoping, sent exclusion, and metadata-only notification responses.
