Home Documentation Contribution |
Next Previous Contents14. Handling MIME types14.1 How Sylpheed checks for Mime typesWhen 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 defines its MIME type mapping table by loading the system wide MIME types file, then the user file. The systeme file is SYSCONFDIR/mime.types (SYSCONFDIR can be defined a compile time), or if it does not exist, /etc/mime.types. The user file is $HOME/.sylpheed/mime.types. A mime.types file consist of one MIME type definition per line, each definition line starting with the name of the MIME type, followed
by a space separated list of the corresponding file extensions. The file can contain empty lines, and comments start with
the 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 # <ftp://ftp.iana.org/in-notes/iana/assignments/media-types/>. # MIME type Extension application/mac-binhex40 hqx application/mac-compactpro cpt application/msword doc application/pdf pdf application/postscript ai eps ps application/rtf rtf application/x-bcpio bcpio application/x-bzip2 bz2 application/x-csh csh application/x-gtar gtar application/x-gzip gz tgz application/x-kword kwd kwt application/x-kspread ksp application/x-kpresenter kpr kpt application/x-kchart chrt application/x-latex latex application/x-sh sh application/x-shar shar application/x-shockwave-flash swf application/x-tar tar application/x-tcl tcl application/x-tex tex application/x-texinfo texinfo texi application/x-troff t tr roff application/x-troff-man man application/zip zip audio/mpeg mpga mp2 mp3 audio/x-aiff aif aiff aifc audio/x-wav wav image/gif gif image/ief ief image/jpeg jpeg jpg jpe image/png png image/tiff tiff tif text/plain asc txt text/rtf rtf text/sgml sgml sgm text/xml xml video/mpeg mpeg mpg mpe video/x-msvideo avi text/html html htm If the file can be found or has the wrong format, Sylpheed 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. 14.2 How Sylpheed handles attachments (reception)When opening an attachment (select the attachment, right click and select Open) Sylpheed 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
Next Previous Contents |
|
Documentation on this site is licensed under the terms of the GNU Free Documentation License, Version 1.2 or later, with no Invariant Sections. Copyright © 2001-2009 The Sylpheed Documentation Project. |