summaryrefslogtreecommitdiffstats
path: root/manual/en/syl_014.sgml
blob: d4ad8a956c310c37ffe9da1f2c03305158b2afb5 (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
<sect>Handling MIME types

<sect1>How Sylpheed checks for Mime types

<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 <it>mime.types</it> 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 <it>SYSCONFDIR/mime.types</it> (SYSCONFDIR can
be defined a compile time), or if it does not exist, <it>/etc/mime.types</it>.
The user file is <it>$HOME/.sylpheed/mime.types</it>.
<p>
A <it>mime.types</it> 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 <tt>#</tt>
character and close at line's end.
<p>
Following is a typical <it>mime.types</it> file (an extract of mine):

<verb>
# 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 
# <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

</verb>

<p>
If the file can be found or has the wrong format, Sylpheed will assume
the default MIME type for all the attachments: <it>application/octet-stream</it>.
In such a case, the recipients mail client may not know what application 
to use to view the attachment.

</sect1>

<sect1>How Sylpheed handles attachments (reception)
<p>
When opening an attachment (select the attachment, right click and select
<it>Open</it>) Sylpheed uses one of the following methods to determine
the application to launch:

<itemize>
	<item>
		The attachment is an image: the application is the one defined by the
		<it>mime_image_viewer</it> variable of the common preferences configuration
		file (<it>$HOME/.sylpheed/sylpheedrc</it>). If no application is defined, or
		if the format of the definition is not valid, the default application
		command is <it>display</it> (ImageMagick viewer).
	</item>
	<item>
		The attachment is a sound file: the application is the one defined by the
		<it>mime_audio_player</it> variable of the common preferences configuration
		file (<it>$HOME/.sylpheed/sylpheedrc</it>). If no application is defined, or
		if the format of the definition is not valid, the default application
		command is <it>play</it>.
	</item>
	<item>
		The attachment is a HTML file: the application is the one defined by the
		<it>uri_cmd</it> variable of the common preferences configuration
		file (<it>$HOME/.sylpheed/sylpheedrc</it>). This can also be changed in the
		<it>Common preferences</it>, by changing the <it>Web browser</it> defined
		in the <it>Other</it> tab.
	</item>
	<item>
		Any other attachment type: Sylpheed relies on <it>metamail</it> to use
		the correct application (Sylpheed starts <it>metamail</it> giving it
		the attachment file and the MIME type taken from the mail).
	</item>
</itemize>

<p>
The binding of the applications to each MIME type is defined in the
<it>mailcap</it> file. The systeme wide file is <it>/etc/mailcap</it>, 
while the user file is <it>$HOME/.mailcap</it>.

<p>
In the mailcap file, there is one definition per line, big lines
can be broken by escaping the newline with a <it>\</it> character,
the first element of the line is the MIME type, then a semi-colon,
(<it>;</it>), 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 (<it>\;</it>) and
the <it>%s</it> string is replaced by the name of the file when
launching the command.

<p>
Following is a typical <it>mailcap</it> file (an extract of mine):

<verb>

image/*; ee %s

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

application/pdf; xpdf %s

text/html; dillo %s

</verb>


</sect1>
</sect>