aboutsummaryrefslogtreecommitdiff
path: root/manual/en/sylpheed-14.html
blob: dde34f2d3a943bbc2ed2626de1ec299c8ea5c601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE>Sylpheed User's Manual: Handling MIME types</TITLE>
 <LINK HREF="sylpheed-15.html" REL=next>
 <LINK HREF="sylpheed-13.html" REL=previous>
 <LINK HREF="sylpheed.html#toc14" REL=contents>
</HEAD>
<BODY>
<A HREF="sylpheed-15.html">Next</A>
<A HREF="sylpheed-13.html">Previous</A>
<A HREF="sylpheed.html#toc14">Contents</A>
<HR>
<H2><A NAME="s14">14. Handling MIME types</A></H2>

<H2><A NAME="ss14.1">14.1 How Sylpheed checks for Mime types</A>
</H2>

<P>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 <I>mime.types</I> 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 <I>SYSCONFDIR/mime.types</I> (SYSCONFDIR can
be defined a compile time), or if it does not exist, <I>/etc/mime.types</I>.
The user file is <I>$HOME/.sylpheed/mime.types</I>.
<P>A <I>mime.types</I> 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 <CODE>#</CODE>
character and close at line's end.
<P>Following is a typical <I>mime.types</I> file (an extract of mine):
<P>
<PRE>
# 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 
# &lt;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
</PRE>
<P>
<P>If the file can be found or has the wrong format, Sylpheed will assume
the default MIME type for all the attachments: <I>application/octet-stream</I>.
In such a case, the recipients mail client may not know what application 
to use to view the attachment.
<P>
<H2><A NAME="ss14.2">14.2 How Sylpheed handles attachments (reception)</A>
</H2>

<P>When opening an attachment (select the attachment, right click and select
<I>Open</I>) Sylpheed uses one of the following methods to determine
the application to launch:
<P>
<UL>
<LI>The attachment is an image: the application is the one defined by the
<I>mime_image_viewer</I> variable of the common preferences configuration
file (<I>$HOME/.sylpheed/sylpheedrc</I>). If no application is defined, or
if the format of the definition is not valid, the default application
command is <I>display</I> (ImageMagick viewer).</LI>
<LI>The attachment is a sound file: the application is the one defined by the
<I>mime_audio_player</I> variable of the common preferences configuration
file (<I>$HOME/.sylpheed/sylpheedrc</I>). If no application is defined, or
if the format of the definition is not valid, the default application
command is <I>play</I>.</LI>
<LI>The attachment is a HTML file: the application is the one defined by the
<I>uri_cmd</I> variable of the common preferences configuration
file (<I>$HOME/.sylpheed/sylpheedrc</I>). This can also be changed in the
<I>Common preferences</I>, by changing the <I>Web browser</I> defined
in the <I>Other</I> tab.</LI>
<LI>Any other attachment type: Sylpheed relies on <I>metamail</I> to use
the correct application (Sylpheed starts <I>metamail</I> giving it
the attachment file and the MIME type taken from the mail).</LI>
</UL>
<P>
<P>The binding of the applications to each MIME type is defined in the
<I>mailcap</I> file. The systeme wide file is <I>/etc/mailcap</I>, 
while the user file is <I>$HOME/.mailcap</I>.
<P>
<P>In the mailcap file, there is one definition per line, big lines
can be broken by escaping the newline with a <I>\</I> character,
the first element of the line is the MIME type, then a semi-colon,
(<I>;</I>), 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 (<I>\;</I>) and
the <I>%s</I> string is replaced by the name of the file when
launching the command.
<P>
<P>Following is a typical <I>mailcap</I> file (an extract of mine):
<P>
<PRE>

image/*; ee %s

video/mpeg; gtv %s
video/*; xanim %s

application/pdf; xpdf %s

text/html; dillo %s
</PRE>
<P>
<P>
<HR>
<A HREF="sylpheed-15.html">Next</A>
<A HREF="sylpheed-13.html">Previous</A>
<A HREF="sylpheed.html#toc14">Contents</A>
</BODY>
</HTML>