I wrote a Python application addrcollector for collecting email addresses from email messages. Addresses can be added by sending a message on standard input or by adding on the command line. Addresses can be retrieved by using a keyword. Old addresses are automatically purged. See the usage output below.

addrcollector: Collect email addresses for later retrieval, or
search the database of previously collected addresses.

Usage:
  addrcollector.py --add ADDRESS [NAME]
  addrcollector.py --import
  addrcollector.py --search WORD...
  addrcollector.py --help

Options, arguments, and commands:
  -a --add      Manually add an address.
  ADDRESS       Email address to add to database.
  NAME          Name to associate with email address (optional).
  -i --import   Import addresses from headers of one message via standard input.
  -s --search   Search database for addresses; multiple keys are ORed.
  WORD          Search key.
  -h --help     Usage help.

Requires: python3-docopt, python3-xdg

addrcollector.py script