collect_addresses is a script created especially to collect email addresses you are replying to. It takes the name of the address book where the new addresses should be stored as an argument and reads an email from stdin.
For example, you could do
cat email | collect_addresses collected
Then, collect_addresses will check if the addresses found in the email header are already existing and non-existing ones will be added to the given address book.
The script was written to be used as a filter in Kmail. Use the following filter for all outgoing emails:
"To" is not in address book
run command: collect_addresses collected