When attaching a file to a message (composing a new message), the MIME type of the attached file is choosen based on the file extension from the mapping list defined in the mime.types file(s). Sylpheed-Claws defines its MIME type mapping table by loading the system wide MIME types file, then the user file. The systeme file is /usr/share/mime/globs or, if this doesn't exist, SYSCONFDIR/mime.types (SYSCONFDIR can be defined at compile time), or if it does not exist, /etc/mime.types.
A mime.types file consist of one MIME type definition per
each definition line starting with the name of the MIME type, followed
a space separated list of the corresponding file extensions.
The file can contain empty lines, and comments start with the
character and close at line's end.
Following is a typical mime.types file (an extract of mine):
# This file controls what Internet media types are sent to the client for
# given file extension(s). Sending the correct media type to the client
# is important so they know how to handle the content of the file.
# The Internet media type registry is at
# MIME type Extension
application/postscript ai eps ps
application/x-gzip gz tgz
application/x-kword kwd kwt
application/x-kpresenter kpr kpt
application/x-texinfo texinfo texi
application/x-troff t tr roff
audio/mpeg mpga mp2 mp3
audio/x-aiff aif aiff aifc
image/jpeg jpeg jpg jpe
image/tiff tiff tif
text/plain asc txt
text/sgml sgml sgm
video/mpeg mpeg mpg mpe
text/html html htm
If the file can be found or has the wrong format, Sylpheed-Claws will assume the default MIME type for all the attachments: application/octet-stream. In such a case, the recipients mail client may not know what application to use to view the attachment.
When opening an attachment (select the attachment, right click and select Open) Sylpheed-Claws uses one of the following methods to determine the application to launch:
The binding of the applications to each MIME type is defined in the mailcap file. The systeme wide file is /etc/mailcap, while the user file is $HOME/.mailcap.
In the mailcap file, there is one definition per line, big lines can be broken by escaping the newline with a \ character, the first element of the line is the MIME type, then a semi-colon, (;), and finally the application to launch. The application part (right side of the semi-colon) can contain several shell commands separated by an escaped semi-colon (\;) and the %s string is replaced by the name of the file when launching the command.
Following is a typical mailcap file (an extract of mine):
image/*; ee %s video/mpeg; gtv %s video/*; xanim %s application/pdf; xpdf %s text/html; dillo %s