From 35f95d85f4fe611600f5090fb1bf44398798cf4a Mon Sep 17 00:00:00 2001 From: fbarriere Date: Tue, 4 Mar 2003 20:13:29 +0000 Subject: Completed the MIME types handling in Sylpheed, added references to metamail. --- manual/en/syl_014.sgml | 147 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 138 insertions(+), 9 deletions(-) (limited to 'manual') diff --git a/manual/en/syl_014.sgml b/manual/en/syl_014.sgml index bdbe411..d4ad8a9 100644 --- a/manual/en/syl_014.sgml +++ b/manual/en/syl_014.sgml @@ -1,22 +1,151 @@ Handling MIME types -How Sylpheed checks for Mime types

+How Sylpheed checks for Mime types -(Thanks to Adriaan Penning for writing this!)

+

+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 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 # +character and close at line's end. +

+Following is a typical mime.types file (an extract of mine): -Two files, mime.types and mailcap, are involved in determining the mime type of an attachment, and the application associated with that mime type. The mime.types file is used to determine the mimetype of attachments you add when composing a message. The mime.types file consists of lines like:

+ +# 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 +# . -application/pdf pdf

+# 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 -Sylpheed looks for this file in SYSCONFDIR (determined at compile time), /etc/ and $HOME/.sylpheed/ + -If this file doesn't exist or has the wrong format, every attachment will have `application/octet-stream' as it's mime type, so the recipients mail client may not know what application to use to view the attachment. +

+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. -To change the default application that sylpheed uses to view an attachment that somebody mailed you, look for a mailcap file like /etc/mailcap or $HOME/.mailcap + + +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 attachment is an image: the application is the one defined by the + mime_image_viewer variable of the common preferences configuration + file ($HOME/.sylpheed/sylpheedrc). If no application is defined, or + if the format of the definition is not valid, the default application + command is display (ImageMagick viewer). + + + The attachment is a sound file: the application is the one defined by the + mime_audio_player variable of the common preferences configuration + file ($HOME/.sylpheed/sylpheedrc). If no application is defined, or + if the format of the definition is not valid, the default application + command is play. + + + The attachment is a HTML file: the application is the one defined by the + uri_cmd variable of the common preferences configuration + file ($HOME/.sylpheed/sylpheedrc). This can also be changed in the + Common preferences, by changing the Web browser defined + in the Other tab. + + + Any other attachment type: Sylpheed relies on metamail to use + the correct application (Sylpheed starts metamail giving it + the attachment file and the MIME type taken from the mail). + + + +

+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 -For example, you can add a line like this in $HOME/.mailcap if you want to view pdf files with xpdf:

+ -application/pdf ; xpdf %s -- cgit