I am trying to fill my abook address book with addresses, but it is tedious as a new user of mutt. So the easiest way would be to simply add all "To:" addresses from my Sent mail folder to the abook address book.

But this doesn't work, apparently only From: addresses are supported. Am I overlooking something or how do I populate my abook address book efficiently with e-mail addresses I already used in the past?


Unfortunately there is no switch for that. One way is to fool abook by passing To: field addresses as From: field. The simplest example would be to put this macro in your .muttrc file:

macro index,pager,attach a  "<pipe-message>sed -e /^From/d -e s/To:/From:/ | abook --add-email<return>" "add the to: address to abook?"

However this will only add first email address to abook. One possible workaround would be to use macro like <pipe-message>your_script, and than your script in whatever programming language you like, will take care of parsing your desired field feeding abook --add-email or abook --add-email-quiet all emails in form of From: email@adress.org

  • Yes, this is probably the only way. Thank you very much. – tungsten May 28 '19 at 2:27
  • I guess it's not worth a new question: As far as I can see it, there is no way to add "To:" addresses to the address book whenever I sent e-mail, right? There is no hook after the e-mail has been sent. – tungsten May 28 '19 at 2:30
  • Sorry, I do not see any easy hack fo r that purpose. – mrajner May 28 '19 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.