O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required