sync with 0.8.11cvs31
[claws.git] / doc / manual / en / sylpheed-14.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
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>
9 </HEAD>
10 <BODY>
11 <A HREF="sylpheed-15.html">Next</A>
12 <A HREF="sylpheed-13.html">Previous</A>
13 <A HREF="sylpheed.html#toc14">Contents</A>
14 <HR>
15 <H2><A NAME="s14">14.</A> <A HREF="sylpheed.html#toc14">Handling MIME types</A></H2>
16
17 <H2><A NAME="ss14.1">14.1</A> <A HREF="sylpheed.html#toc14.1">How Sylpheed checks for Mime types</A>
18 </H2>
19
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>
34 <P>
35 <PRE>
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 # &lt;ftp://ftp.iana.org/in-notes/iana/assignments/media-types/>.
41
42 # MIME type                     Extension
43 application/mac-binhex40        hqx
44 application/mac-compactpro      cpt
45 application/msword              doc
46 application/pdf                 pdf
47 application/postscript          ai eps ps
48 application/rtf                 rtf
49 application/x-bcpio             bcpio
50 application/x-bzip2             bz2
51 application/x-csh               csh
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
59 application/x-sh                sh
60 application/x-shar              shar
61 application/x-shockwave-flash   swf
62 application/x-tar               tar
63 application/x-tcl               tcl
64 application/x-tex               tex
65 application/x-texinfo           texinfo texi
66 application/x-troff             t tr roff
67 application/x-troff-man         man
68 application/zip                 zip
69 audio/mpeg                      mpga mp2 mp3
70 audio/x-aiff                    aif aiff aifc
71 audio/x-wav                     wav
72 image/gif                       gif
73 image/ief                       ief
74 image/jpeg                      jpeg jpg jpe
75 image/png                       png
76 image/tiff                      tiff tif
77 text/plain                      asc txt
78 text/rtf                        rtf
79 text/sgml                       sgml sgm
80 text/xml                        xml
81 video/mpeg                      mpeg mpg mpe
82 video/x-msvideo                 avi
83 text/html                       html htm
84 </PRE>
85 </P>
86
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>
91
92 <H2><A NAME="ss14.2">14.2</A> <A HREF="sylpheed.html#toc14.2">How Sylpheed handles attachments (reception)</A>
93 </H2>
94
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>
98 <P>
99 <UL>
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>
118 </UL>
119 </P>
120
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>
124
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>
133
134 <P>Following is a typical <I>mailcap</I> file (an extract of mine):</P>
135 <P>
136 <PRE>
137
138 image/*; ee %s
139
140 video/mpeg; gtv %s
141 video/*; xanim %s
142
143 application/pdf; xpdf %s
144
145 text/html; dillo %s
146 </PRE>
147 </P>
148
149
150 <HR>
151 <A HREF="sylpheed-15.html">Next</A>
152 <A HREF="sylpheed-13.html">Previous</A>
153 <A HREF="sylpheed.html#toc14">Contents</A>
154 </BODY>
155 </HTML>