1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
4 <meta name="GENERATOR" content="LinuxDoc-Tools 0.9.21">
5 <title>Sylpheed-Claws 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">12.</a> <a href="sylpheed.html#toc14">Handling MIME
17 <h2><a name="ss14.1">12.1</a> <a href="sylpheed.html#toc14.1">How
18 Sylpheed-Claws 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-Claws defines its MIME type mapping table by loading the
24 system wide MIME types file, then the user file.
25 The systeme file is <span style="font-style: italic;">/usr/share/mime/globs
26 </span>or, if this doesn't exist, <span style="font-style: italic;">SYSCONFDIR/</span><i>mime.types</i>
28 be defined at compile time), or if it does not exist, <i>/etc/mime.types</i>. </p>
29 <p>A <i>mime.types</i> file consist of one MIME type definition per
31 each definition line starting with the name of the MIME type, followed
33 a space separated list of the corresponding file extensions.
34 The file can contain empty lines, and comments start with the <code>#</code>
35 character and close at line's end.</p>
36 <p>Following is a typical <i>mime.types</i> file (an extract of mine):</p>
39 <pre># This file controls what Internet media types are sent to the client for<br># given file extension(s). Sending the correct media type to the client<br># is important so they know how to handle the content of the file.<br># The Internet media type registry is at <br># <ftp://ftp.iana.org/in-notes/iana/assignments/media-types/>.<br><br># MIME type Extension<br>application/mac-binhex40 hqx<br>application/mac-compactpro cpt<br>application/msword doc<br>application/pdf pdf<br>application/postscript ai eps ps<br>application/rtf rtf<br>application/x-bcpio bcpio<br>application/x-bzip2 bz2<br>application/x-csh csh<br>application/x-gtar gtar<br>application/x-gzip gz tgz<br>application/x-kword kwd kwt<br>application/x-kspread ksp<br>application/x-kpresenter kpr kpt<br>application/x-kchart chrt<br>application/x-latex latex<br>application/x-sh sh<br>application/x-shar shar<br>application/x-shockwave-flash swf<br>application/x-tar tar<br>application/x-tcl tcl<br>application/x-tex tex<br>application/x-texinfo texinfo texi<br>application/x-troff t tr roff<br>application/x-troff-man man<br>application/zip zip<br>audio/mpeg mpga mp2 mp3<br>audio/x-aiff aif aiff aifc<br>audio/x-wav wav<br>image/gif gif<br>image/ief ief<br>image/jpeg jpeg jpg jpe<br>image/png png<br>image/tiff tiff tif<br>text/plain asc txt<br>text/rtf rtf<br>text/sgml sgml sgm<br>text/xml xml<br>video/mpeg mpeg mpg mpe<br>video/x-msvideo avi<br>text/html html htm<br></pre>
41 <p>If the file can be found or has the wrong format, Sylpheed-Claws will
43 the default MIME type for all the attachments: <i>application/octet-stream</i>.
44 In such a case, the recipients mail client may not know what
45 application to use to view the attachment.</p>
46 <h2><a name="ss14.2">12.2</a> <a href="sylpheed.html#toc14.2">How
47 Sylpheed-Claws handles attachments (reception)</a>
49 <p>When opening an attachment (select the attachment, right click and
51 <i>Open</i>) Sylpheed-Claws uses one of the following methods to determine
52 the application to launch:</p>
56 <li>The attachment is an image: the application is the one defined by
58 <i>mime_image_viewer</i> variable of the common preferences
60 file (<i>$HOME/.sylpheed/sylpheedrc</i>). If no application is defined,
62 if the format of the definition is not valid, the default application
63 command is <i>display</i> (ImageMagick viewer).</li>
64 <li>The attachment is a sound file: the application is the one
66 <i>mime_audio_player</i> variable of the common preferences
68 file (<i>$HOME/.sylpheed/sylpheedrc</i>). If no application is defined,
70 if the format of the definition is not valid, the default application
71 command is <i>play</i>.</li>
72 <li>The attachment is a HTML file: the application is the one defined
74 <i>uri_cmd</i> variable of the common preferences configuration
75 file (<i>$HOME/.sylpheed/sylpheedrc</i>). This can also be changed in
77 <i>Common preferences</i>, by changing the <i>Web browser</i>
79 in the <i>Other</i> tab.</li>
80 <li>Any other attachment type: Sylpheed-Claws relies on <i>metamail</i> to
82 the correct application (Sylpheed-Claws starts <i>metamail</i> giving it
83 the attachment file and the MIME type taken from the mail).</li>
86 <p>The binding of the applications to each MIME type is defined in the
87 <i>mailcap</i> file. The systeme wide file is <i>/etc/mailcap</i>,
88 while the user file is <i>$HOME/.mailcap</i>.</p>
89 <p>In the mailcap file, there is one definition per line, big lines
90 can be broken by escaping the newline with a <i>\</i> character,
91 the first element of the line is the MIME type, then a semi-colon,
92 (<i>;</i>), and finally the application to launch.
93 The application part (right side of the semi-colon) can contain several
94 shell commands separated by an escaped semi-colon (<i>\;</i>) and
95 the <i>%s</i> string is replaced by the name of the file when
96 launching the command.</p>
97 <p>Following is a typical <i>mailcap</i> file (an extract of mine):</p>
106 application/pdf; xpdf %s
112 <a href="sylpheed-15.html">Next</a>
113 <a href="sylpheed-13.html">Previous</a>
114 <a href="sylpheed.html#toc14">Contents</a>