LBDB-FETCHADDR(1)

πŸ’Œ lbdb-fetchaddr β€” the manual page, but make it cute

okay so bestie, this is lbdb-fetchaddr(1) from the User Manuals section, and it's genuinely one of the most lowkey iconic little scripts in the whole lbdb package. it grabs addresses from your mail and appends them to the lbdb database. that's the whole vibe. let's get into it πŸ’–


✨ NAME ✨

lbdb-fetchaddr β€” grab addresses from mails and append them to the lbdb database 🫢


🌸 SYNOPSIS 🌸

lbdb-fetchaddr [-d dateformat] [-x headerfieldlist] [-c charset] [-a] [-f databasefile]
lbdb-fetchaddr [-v|-h]

πŸŽ€ DESCRIPTION πŸŽ€

so like, lbdb-fetchaddr is a shell script, right? and what it does is it reads a mail on stdin. yes, the whole mail, straight in through the front door πŸšͺ

then it extracts the contents of some header fields β€” and the defaults are From:, To:, Cc:, Resent-From:, and Resent-To: β€” out of the mail header. only addresses with a real name though, just so we're clear πŸ‘‘

then it appends them to the database file. and that file defaults to $XDG_DATA_HOME/lbdb/m_inmail.db, or $HOME/.lbdb/m_inmail.utf-8 if the latter already exists β€” that one's there for backward compatibility, iykyk πŸ¦‹

ngl there's a whole thing here about performance. for performance issues, lbdb-fetchaddr appends new addresses to this file without removing duplicates. it's just not doing that. periodt. to actually get rid of duplicates, the program lbdb-munge exists, and it gets run by m_inmail if needed, and it removes the duplicates. so that's the division of labour, bestie πŸ’…

so to use this program, you put the following lines into your $HOME/.procmailrc:

:0hc
| lbdb-fetchaddr

lbdb-fetchaddr writes the actual date to the third column of the database, using strftime(3). it uses "%Y-%m-%d %H:%M" as the default date format (e.g. "1999-04-29 14:33"). you can change this by using the -d option to select a different date format string as parameter of the lbdb-fetchaddr command, like:

:0hc
| lbdb-fetchaddr -d "%y-%m-%d"

which results in e.g. "99-04-29". obsessed with the flexibility honestly 🌈


πŸ’… OPTIONS πŸ’…

  • -v β€” print version number of lbdb-fetchaddr. short and sweet, she's just saying hi πŸ’–
  • -h β€” print short help of lbdb-fetchaddr. the little "here's how you use me" moment πŸ₯Ί
  • -d dateformat β€” use the given date format using strftime(3) syntax. your date, your rules ✨
  • -x headerfields β€” a colon separated list of header fields, which should be searched for mail addresses. if this option isn't given, we fall back to from:to:cc:resent-from:resent-to. note the colons, not commas, bestie, do not get it twisted 😭
  • -c charset β€” the charset which will be used to write the database. this should be the charset which the application expects (normally the one from your current locale). if this option isn't given, we fall back to utf-8. she's giving locale-aware πŸ‘‘
  • -a β€” also grab addresses without a real name. use the local part of the mail address as real name. so like, no name? fine, we're using the part before the @. main character energy, honestly πŸŽ€
  • -f databasefile β€” use the given file for storing the grabbed addresses instead of using the $XDG_DATA_HOME/lbdb/m_inmail.db resp. $HOME/.lbdb/m_inmail.utf-8 default. you want it somewhere else? say less 🌸

πŸ¦‹ FILES πŸ¦‹

  • $XDG_DATA_HOME/lbdb/m_inmail.db
  • $HOME/.lbdb/m_inmail.utf-8 (old version before using $XDG_DATA_HOME)
  • $HOME/.lbdb/m_inmail.list (old version used for ISO-8859-15 encoded addresses)
  • /usr/libexec/lbdb/fetchaddr
  • /usr/libexec/lbdb/m_inmail

πŸ”₯ SEE ALSO πŸ”₯

lbdbq(1), lbdb_dotlock(1), procmail(1), procmailrc(5), strftime(3).

go read those too, they're all part of the family 🫢


⭐ CREDITS ⭐

most of the really interesting code of this program (namely, the RFC 822 address parser used by lbdb-fetchaddr) was stolen from Michael Elkins' mutt mail user agent. okay not "stolen" stolen, it's a credit, we're being honest here 😭

additional credits go to Brandon Long for putting the query functionality into mutt. kings, both of them πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

the lbdb package was written by Thomas Roessler <roessler@guug.de> and is now maintained and extended by Roland Rosenfeld <roland@spinnaker.de>.


okay that's the whole page bestie, you're fully caught up, no cap πŸ’–

and that's a wrap on lbdb-fetchaddr(1) β€” this one lives in the Unix User Manuals, dated April 2025, and it ate, fr fr. go fetch some addresses, you've got this πŸŒˆβœ¨πŸ’…

πŸ“¦ where this page comes from