1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
4 <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
5 <TITLE>Sylpheed User's Manual: Handling MIME types</TITLE>
6 <LINK HREF="sylpheed-15.html" REL=next>
7 <LINK HREF="sylpheed-13.html" REL=previous>
8 <LINK HREF="sylpheed.html#toc14" REL=contents>
11 <A HREF="sylpheed-15.html">Next</A>
12 <A HREF="sylpheed-13.html">Previous</A>
13 <A HREF="sylpheed.html#toc14">Contents</A>
15 <H2><A NAME="s14">14.</A> <A HREF="sylpheed.html#toc14">Handling MIME types</A></H2>
17 <H2><A NAME="ss14.1">14.1</A> <A HREF="sylpheed.html#toc14.1">How Sylpheed checks for Mime types</A>
20 <P>When attaching a file to a message (composing a new message), the
21 MIME type of the attached file is choosen based on the file extension
22 from the mapping list defined in the <I>mime.types</I> file(s).
23 Sylpheed defines its MIME type mapping table by loading the
24 system wide MIME types file, then the user file.
25 The systeme file is <I>SYSCONFDIR/mime.types</I> (SYSCONFDIR can
26 be defined a compile time), or if it does not exist, <I>/etc/mime.types</I>.
27 The user file is <I>$HOME/.sylpheed/mime.types</I>.</P>
28 <P>A <I>mime.types</I> file consist of one MIME type definition per line,
29 each definition line starting with the name of the MIME type, followed by
30 a space separated list of the corresponding file extensions.
31 The file can contain empty lines, and comments start with the <CODE>#</CODE>
32 character and close at line's end.</P>
33 <P>Following is a typical <I>mime.types</I> file (an extract of mine):</P>
36 # This file controls what Internet media types are sent to the client for
37 # given file extension(s). Sending the correct media type to the client
38 # is important so they know how to handle the content of the file.
39 # The Internet media type registry is at
40 # <ftp://ftp.iana.org/in-notes/iana/assignments/media-types/>.
43 application/mac-binhex40 hqx
44 application/mac-compactpro cpt
45 application/msword doc
47 application/postscript ai eps ps
49 application/x-bcpio bcpio
50 application/x-bzip2 bz2
52 application/x-gtar gtar
53 application/x-gzip gz tgz
54 application/x-kword kwd kwt
55 application/x-kspread ksp
56 application/x-kpresenter kpr kpt
57 application/x-kchart chrt
58 application/x-latex latex
60 application/x-shar shar
61 application/x-shockwave-flash swf
65 application/x-texinfo texinfo texi
66 application/x-troff t tr roff
67 application/x-troff-man man
69 audio/mpeg mpga mp2 mp3
70 audio/x-aiff aif aiff aifc
74 image/jpeg jpeg jpg jpe
81 video/mpeg mpeg mpg mpe
87 <P>If the file can be found or has the wrong format, Sylpheed will assume
88 the default MIME type for all the attachments: <I>application/octet-stream</I>.
89 In such a case, the recipients mail client may not know what application
90 to use to view the attachment.</P>
92 <H2><A NAME="ss14.2">14.2</A> <A HREF="sylpheed.html#toc14.2">How Sylpheed handles attachments (reception)</A>
95 <P>When opening an attachment (select the attachment, right click and select
96 <I>Open</I>) Sylpheed uses one of the following methods to determine
97 the application to launch:</P>
100 <LI>The attachment is an image: the application is the one defined by the
101 <I>mime_image_viewer</I> variable of the common preferences configuration
102 file (<I>$HOME/.sylpheed/sylpheedrc</I>). If no application is defined, or
103 if the format of the definition is not valid, the default application
104 command is <I>display</I> (ImageMagick viewer).</LI>
105 <LI>The attachment is a sound file: the application is the one defined by the
106 <I>mime_audio_player</I> variable of the common preferences configuration
107 file (<I>$HOME/.sylpheed/sylpheedrc</I>). If no application is defined, or
108 if the format of the definition is not valid, the default application
109 command is <I>play</I>.</LI>
110 <LI>The attachment is a HTML file: the application is the one defined by the
111 <I>uri_cmd</I> variable of the common preferences configuration
112 file (<I>$HOME/.sylpheed/sylpheedrc</I>). This can also be changed in the
113 <I>Common preferences</I>, by changing the <I>Web browser</I> defined
114 in the <I>Other</I> tab.</LI>
115 <LI>Any other attachment type: Sylpheed relies on <I>metamail</I> to use
116 the correct application (Sylpheed starts <I>metamail</I> giving it
117 the attachment file and the MIME type taken from the mail).</LI>
121 <P>The binding of the applications to each MIME type is defined in the
122 <I>mailcap</I> file. The systeme wide file is <I>/etc/mailcap</I>,
123 while the user file is <I>$HOME/.mailcap</I>.</P>
125 <P>In the mailcap file, there is one definition per line, big lines
126 can be broken by escaping the newline with a <I>\</I> character,
127 the first element of the line is the MIME type, then a semi-colon,
128 (<I>;</I>), and finally the application to launch.
129 The application part (right side of the semi-colon) can contain several
130 shell commands separated by an escaped semi-colon (<I>\;</I>) and
131 the <I>%s</I> string is replaced by the name of the file when
132 launching the command.</P>
134 <P>Following is a typical <I>mailcap</I> file (an extract of mine):</P>
143 application/pdf; xpdf %s
151 <A HREF="sylpheed-15.html">Next</A>
152 <A HREF="sylpheed-13.html">Previous</A>
153 <A HREF="sylpheed.html#toc14">Contents</A>