Closed pigmonkey closed 11 years ago
The way I'd probably achieve this is by adding something like the mail gem as a dependency and writing something along these lines:
email = Mail.new($stdin)
contact = Ppl::Entity::Contact.new
contact.email_addresses << email.sender.address
So while ppl would nominally be scraping messages, this is functionality we can have without any real scope creep in terms of adding lots of "clever" code to ppl.
I like this idea. I think I'd probably use mutt more often if I had more helpful stuff like this set up, so this has caught my imagination a little. I think the way I'll go with this is to implement it in the form of some sort of emailscrape
(definitely not its final name) command, with flags like --sender
and --recipients
for indicating which types of email addresses are to be scraped into the address book. That way it has room to grow into other use-cases, such as scraping all email addresses from the headers and body of an email which I think is what GMail does.
And since this is partly about abook feature parity, this will probably eventually need a --quiet
flag as a counterpart to abook's --add-email-quiet
. But that can wait.
This is in 1.19.0
as the scrape command
This is the last issue that is preventing me from fully migrating from abook to ppl!
abook has an
--add-email
argument. According to the man page:In my
~/.muttrc
I use it like this:When I'm on a message in Mutt I hit the
a
key. I'm then prompted if I want to add the sender to abook.I'm prompted like this for every sender found in the message. This includes the sender set in the header, but if it is a forwarded message it also includes the sender of the original message.
If I hit 'y', a new contact is added to my address book with a name of "John Doe" and an email of "john@doe.com".
If the message did not have a proper
From:
header set with the sender's name, the prompt would look like this:If I selected 'y' the new contact would then have a name of "john@doe.com".
Adding this functionality would expand the scope of ppl from just managing contacts to also scraping messages. I understand if you do not want to go down that road. It may make more sense just to write a small, separate script that does the scraping and passes the results to ppl.