mailcap

The mailcap module is used to read UNIX mailcap files. Mailcap files are used to tell mail readers and web browsers how to process files with different MIME types. The contents of a mailcap file typically look something like this:

video/mpeg; xmpeg %s
application/pdf; acroread %s

When data of a given MIME type is encountered, the mailcap file is consulted to find an application for handling that data.

getcaps()

Reads all available mailcap files and returns a dictionary mapping MIME types to a mailcap entry. mailcap files are read from $HOME/.mailcap, /etc/mailcap, /usr/etc/mailcap, and /usr/local/etc/mailcap.

findmatch(caps, mimetype [, key [, filename [, plist]]])

Searches the dictionary caps for a mailcap entry matching mimetype. The ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.