New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a message sender as a contact #23

Closed
pigmonkey opened this Issue Apr 12, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@pigmonkey
Contributor

pigmonkey commented Apr 12, 2013

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:

--add-email
          Read an e-mail message from stdin and add the sender to the addressbook.

In my ~/.muttrc I use it like this:

# Add sender to address book
macro index,pager a "<pipe-message>abook --add-email<return>"

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.

Add "John Doe <john@doe.com>" to /home/user/.addressbook? (y/n)

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:

Add "john@doe.com <john@doe.com>" to /home/user/.addressbook? (y/n)

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.

@hnrysmth

This comment has been minimized.

Show comment
Hide comment
@hnrysmth

hnrysmth Apr 13, 2013

Owner

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.

Owner

hnrysmth commented Apr 13, 2013

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.

@ghost ghost assigned hnrysmth Apr 13, 2013

hnrysmth added a commit that referenced this issue Apr 17, 2013

Implement the simplest possible form of a "scrape" command for hnrysm…
…th/ppl#23

This isn't done yet. It's not been tested thoroughly enough to release, and it
still has a few bits of missing functionality.

- It needs to autogenerate a contact ID based on their display_name
- It needs to not trip over and die if any of the properties it depends on
  aren't present

I'm thinking this might actually be another prime candidate for a Ppl::Adapter
mail-scraping interface.
@hnrysmth

This comment has been minimized.

Show comment
Hide comment
@hnrysmth

hnrysmth Apr 19, 2013

Owner

This is in 1.19.0 as the scrape command

Owner

hnrysmth commented Apr 19, 2013

This is in 1.19.0 as the scrape command

@hnrysmth hnrysmth closed this Apr 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment