Collect sender addresses from incoming messages for autocomplete
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 348
- Avg merge
- 12h 28m
- Merged PRs (30d)
- 91
Description
Is your feature request related to a problem? Please describe.
Nextcloud Mail currently collects addresses from outgoing messages, using the To/Cc/Bcc recipients of sent mail.
This means that people who only send mail to the user, but have never received a message from the user, may not appear in Mail's address autocomplete.
For example, when using the advanced search "From" field, many valid senders are missing from the autocomplete suggestions even though the user has received many messages from them.
Describe the solution you'd like
Collect the From address of newly synchronized incoming messages, preferably for messages synchronized into the INBOX.
The existing AddressCollector and mail_coll_addresses mechanism could be reused.
The feature should also respect the existing collect-data user preference, just like outgoing address collection does.
Conceptually:
MessageSentEvent- continue collecting To/Cc/Bcc addresses
NewMessagesSynchronized- if mailbox is INBOX
- collect the From addresses of the newly synchronized messages
The existing deduplication logic in AddressCollector can prevent duplicate entries.
So, if a user receives a message from:
John Example john@example.com
then john@example.com should become available in Mail address autocomplete even if the user has never sent an email to that address.
Describe alternatives you've considered
No response
Additional context
We implemented and tested this locally with Nextcloud Mail 5.12.0 by registering AddressCollectionListener for NewMessagesSynchronized and passing each incoming message's From address to the existing AddressCollector.
The feature works correctly with the existing collected-address autocomplete mechanism.
This request is primarily about collecting addresses from newly synchronized incoming messages. Historical backfilling of already-synchronized messages could be considered separately.
Nextcloud version: 34.0.2
Mailserver or service: Gmail / IMAP
Operating system: Debian GNU/Linux 13 (trixie)
PHP: 8.5.10
Web server: Apache 2.4.68
Database: PostgreSQL
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing AddressCollectionListener, AddressCollector, MessageSentEvent, and NewMessagesSynchronized, then inspect how the collect-data preference and mail_coll_addresses storage are used. Handle newly synchronized INBOX messages by collecting their From addresses while preserving existing deduplication and outgoing collection behavior. Done means newly received senders appear in autocomplete without collecting addresses when the preference is disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100