Mailbox Cleanup: subscriptions view with unsubscribe and per-sender state

Open
#733 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript

Research direction

Start by tracing the existing Settings > Mail > Cleanup view and the /mailbox-usage sender grouping, then inspect POST /messages/:id/unsubscribe and its RFC 8058 and fallback behavior. Implement the paged sender query and row states, constrain Delete all to inbox messages with list_unsubscribe, and add the specified backend and frontend tests. Done includes an EXPLAIN ANALYZE for a mailbox with at least 100k messages.

Written by the indexing model from the issue text.

Description

enhancement help wanted

What

Extend Settings > Mail > Cleanup (beta) into a per-account subscriptions view: every sender whose mail carries a List-Unsubscribe header, with an Unsubscribe action and an "unsubscribed on" state, alongside the existing per-sender Archive / Move to Trash.

Users consolidating years of mail across several accounts hold thousands of newsletter and mailing-list messages. Cleanup today shows only the top 25 bulk senders in the inbox, and unsubscribing means opening one message per sender.

Scope

  1. Sender list. Group by lower(from_email) (as /mailbox-usage does) over messages where list_unsubscribe is present, not by is_bulk. Per row: sender name, address, message count, last received date. Paged, so it isn't capped at 25.
  2. Delete all from this sender. Same actions as today: Archive by default (#403), Move to Trash optional, confirmation showing the count. Scope stays inbox messages carrying the header. Some senders put List-Unsubscribe on receipts and account notices, so this must never reach a message without the header or outside the inbox. Widening to other folders is out of scope here.
  3. Unsubscribe. Calls the existing POST /messages/:id/unsubscribe on the sender's newest message that has the header, reusing its RFC 8058 one-click path and its private-address and redirect checks. When one-click isn't offered, use the fallback the route already returns (URL or mailto). No bulk "unsubscribe all": requests go out one sender at a time, on the user's action.
  4. Unsubscribed state. No migration: derive it from the newest unsubscribed_at across the sender's messages. Show "Unsubscribed on ". Hide the row when no message has arrived after that date; show it again if one does, since that means the unsubscribe didn't take.
  5. Performance. Include EXPLAIN ANALYZE for the sender query on a large mailbox (100k+ messages) in the PR.

Not in scope

  • New plugin API capabilities (aggregate reads, unsubscribe, delete by sender). These stay in core.
  • Folders other than the inbox for Delete all.

Tests

  • Backend: the sender query (grouping, counts, last date, unsubscribed state, row hiding), and that Delete all never reaches a message without the header or outside the inbox.
  • Frontend: render tests for the row states (subscribed, unsubscribed, unsubscribed with newer mail).

Contributions welcome. Please comment here before starting so the work isn't duplicated.

Dominant language
JavaScript
Stars
518
Forks
50
Avg merge
4d 45m
Merged PRs (30d)
43

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from maathimself/mailflow

All issues in maathimself/mailflow

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.