getaddr
is a Perl script I wrote as an extension to the
wonderful email client MH. I use it to extract email addresses
from messages and add aliases for them to my aliases file. (the aliases
file is MH-speak for what most MUAs call the address book).
(If you don't know what MH is, here's a good place to start: it's the online version of the O'Reilly book MH & xmh: Email for Users & Programmers.)
Standard MH offers no facilities for helping you to add new entries
to the aliases file: you're expected to just edit it with your favourite
editor. This is fair enough, but I got tired of viewing a message and
cutting-and-pasting the email address into an editor buffer, so I wrote
getaddr
.
getaddr
is intelligent about its argument
parsing, so you can say things like:
getaddr
getaddr fred
getaddr 54
getaddr +inbox last
getaddr --force mark
Another reason for writing the script was to demonstrate just how easy it is to add programs to MH such that they effectively become part of the MUA. How many other mailers could you add a 'get address' function to so easily, using the language of your choice? I've tried to make it act like the standard MH programs, so it accepts 'cur', 'first', 'last', etc as message specifications.
You can look at the script itself if you like.
NB: this code is covered by a copyright similar to the XFree86 copyright. See the script for exact text, but basically you can do what you like with the code, but don't remove my name and don't blame me if it eats your aliases file :-)