Most desktop environments use Freedesktop.org MIME Actions spec. Every program has a
.desktop file in
~/.local/share/applications, providing information about the program and the MIME types it accepts. User's own preferences are kept in
URI schemes, such as
mailto:, are simply listed as special
x-scheme-handler/scheme MIME types. (Older programs may still be using GNOME- or KDE-specific URI scheme databases, though.)
Some "traditional" mail programs, such as Alpine or Mutt, still use the older
~/.mailcap file for determining the best tool to view attachments with. This is partially because they are purely terminal-based, and require different mechanisms.