e5089e117dc63d01372c47c7fe314562c10ccbe1
[elisp/gnus-doc-ja.git] / emacs-mime-ja.texi
1 \input texinfo
2
3 @setfilename emacs-mime-ja
4 @settitle Emacs MIME Manual
5 @synindex fn cp
6 @synindex vr cp
7 @synindex pg cp
8
9 @copying
10 \e$B$3$N%U%!%$%k$O\e(B Emacs MIME \e$B%$%s%?!<%U%'!<%9$N5!G=$rJ8=q2=$7$?$b$N$G$9!#\e(B
11
12 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
13           Free Software Foundation, Inc.
14
15 @quotation
16 Permission is granted to copy, distribute and/or modify this document
17 under the terms of the GNU Free Documentation License, Version 1.1 or
18 any later version published by the Free Software Foundation; with no
19 Invariant Sections, with the Front-Cover texts being ``A GNU
20 Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
21 license is included in the section entitled ``GNU Free Documentation
22 License'' in the Emacs manual.
23
24 \e$B$3$NJ8=q$r!"%U%j!<%=%U%H%&%'%":bCDH/9T$N\e(B GNU \e$B%U%j!<J8=qMxMQ5vBz7@Ls=q\e(B
25 \e$BBh\e(B 1.1 \e$BHG$^$?$O$=$l0J9_$NHG$,Dj$a$k>r7o$N2<$GJ#@=!"G[I[!"$"$k$$$OJQ99$9\e(B
26 \e$B$k$3$H$r5v2D$7$^$9!#JQ99IT2DItJ,$O;XDj$7$^$;$s!#!V\e(BA GNU Manual\e$B!W$OI=I=;f\e(B
27 \e$B%F%-%9%H!"0J2<$N\e(B (a) \e$B$ON"I=;f%F%-%9%H$G$9!#$3$NMxMQ5vBz7@Ls=q$NJ#<L$O\e(B
28 \e$B!V\e(BEmacs manual\e$B!W$N!V\e(BGNU \e$B%U%j!<J8=qMxMQ5vBz7@Ls=q!W$H$$$&>O$K4^$^$l$F$$$^\e(B
29 \e$B$9!#\e(B
30
31 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
32 this GNU Manual, like GNU software.  Copies published by the Free
33 Software Foundation raise funds for GNU development.''
34
35 (a) FSF \e$B$NN"I=;f%F%-%9%H\e(B:\e$B!V$"$J$?$K$O$3$N\e(B GNU Manual \e$B$r\e(B GNU \e$B%=%U%H%&%'%"\e(B
36 \e$B$N$h$&$KJ#@=$7$?$jJQ99$9$k<+M3$,$"$j$^$9!#J#@=$O%U%j!<%=%U%H%&%'%":bCD$K\e(B
37 \e$B$h$C$F=PHG$5$l$^$7$?!#\e(B(\e$B%U%j!<%=%U%H%&%'%":bCD$O\e(B) GNU \e$B$N3+H/$N$?$a$KI,MW\e(B
38 \e$B$J;q6b$r=8$a$F$$$^$9!#!W\e(B
39
40 This document is part of a collection distributed under the GNU Free
41 Documentation License.  If you want to distribute this document
42 separately from the collection, you can do so by adding a copy of the
43 license to the document, as described in section 6 of the license.
44
45 \e$B$3$NJ8=q$O!V\e(BGNU \e$B%U%j!<J8=qMxMQ5vBz7@Ls=q!W$K4p$E$$$FG[I[$5$l$?<}=8Cx:nJ*\e(B
46 \e$B$N0lIt$G$9!#$b$7$"$J$?$,$3$NJ8=q$r<}=8Cx:nJ*$+$iJ,N%$7$FG[I[$7$?$$$H$-$O!"\e(B
47 \e$B7@Ls=q$NBh\e(B 6 \e$B9`$K5-=R$5$l$F$$$k$h$&$K!"J8=q$K7@Ls=q$NJ#<L$rIU2C$9$k$3$H\e(B
48 \e$B$K$h$C$F!"9T$J$&$3$H$,$G$-$^$9!#\e(B
49 @end quotation
50 @end copying
51
52 @dircategory Emacs
53 @direntry
54 * Emacs MIME-ja: (emacs-mime-ja). Emacs MIME de/composition library (Japanese).
55 @end direntry
56 @iftex
57 @finalout
58 @end iftex
59 @setchapternewpage odd
60
61 @titlepage
62 @title Emacs MIME Manual
63
64 @author by Lars Magne Ingebrigtsen
65 @page
66 @vskip 0pt plus 1filll
67 @insertcopying
68 @end titlepage
69
70 @node Top
71 @top Emacs MIME
72
73 \e$B$3$N%^%K%e%"%k$O\e(B @acronym{MIME} \e$B%a%C%;!<%8$NI=<($H:n@.$K;H$o$l$k%i%$%V%i\e(B
74 \e$B%j!<$rJ8=q2=$7$?$b$N$G$9!#\e(B
75
76 \e$B$3$N%^%K%e%"%k$O!"\e(B@acronym{MIME} \e$B$N%(%s%3!<%I\e(B/\e$B%G%3!<%I!&%W%m%;%9$N?6$kIq\e(B
77 \e$B$$$rJQ99$7$?$$$+!"\e(BEmacs @acronym{MIME} \e$B%i%$%V%i%j!<$,$I$N$h$&$KF0:n$9$k\e(B
78 \e$B$+$N$b$C$H>\:Y$JIA<L$rK>$`%f!<%6!"$*$h$S\e(B @acronym{MIME} \e$B$NMWAG$rA`:n$9$k\e(B
79 \e$B4X?t$*$h$S%3%^%s%I$r=q$-$?$$?M$?$A$rBP>]$K$7$F$$$^$9!#\e(B
80
81 @acronym{MIME} \e$B$O\e(B @dfn{Multipurpose Internet Mail Extensions} \e$B$N>JN,I=5-\e(B
82 \e$B$G$9!#$3$NI8=`$OB??t$N\e(B RFC \e$B$KJ8=q2=$5$l$F$$$F!"<g$J$b$N$O<!$NDL$j$G$9\e(B:
83 RFC2045 (\e$B%$%s%?!<%M%C%H!&%a%C%;!<%8K\J8$N=q<0\e(B), RFC2046 (\e$B%a%G%#%"%?%$%W\e(B),
84 RFC2047 (\e$B%a%C%;!<%8%X%C%@!<$NHs\e(B-@acronym{ASCII} \e$B%F%-%9%H3HD%\e(B),
85 RFC2048 (\e$BEPO?<jB3\e(B), RFC2049 (\e$BE,9g4p=`$H;vNc\e(B)\e$B!#\e(B@acronym{MIME} \e$B$K=`5r$7$?\e(B
86 \e$B%=%U%H%&%'%"$r=q$3$&$H;W$C$F$$$k?M$OC/$G$b!">/$J$/$H\e(B
87 \e$B$b\e(B RFC2045 \e$B$H\e(B RFC2047 \e$B$OFI$s$G$*$/$3$H$r6/$/4+$a$^$9!#\e(B
88
89 @menu
90 * Decoding and Viewing::  \e$B%G%3!<%I$HI=<($N$?$a$NOHAH$_\e(B
91 * Composing::             @acronym{MML}; @acronym{MIME} \e$B%Q!<%H5-=RMQ8@8l\e(B
92 * Interface Functions::   \e$B4pK\E*$J4X?t$K4X$9$kCj>]35G0\e(B
93 * Basic Functions::       \e$B%f!<%F%#%j%F%#!<$*$h$S4pK\E*$J2r@O$N$?$a$N4X?t\e(B
94 * Standards::             \e$B;H$o$l$F$$$k\e(B RFC \e$B$H:n6HJ8=q$N35N,\e(B
95 * Index::                 \e$B4X?t$*$h$SJQ?t$N:w0z\e(B
96 @end menu
97
98 @node Decoding and Viewing
99 @chapter \e$B%G%3!<%I$HI=<(\e(B
100
101 \e$B$3$N>O$O!">e0L3,AX$G$N\e(B @acronym{MIME} \e$B%a%C%;!<%8$N%G%3!<%I$HI=<($r07$$$^\e(B
102 \e$B$9!#\e(B
103
104 \e$B$=$N<g$JL\E*$O!":G=i$K\e(B @acronym{MIME} \e$B$N5-;v$r2r@O$7!"<!$K$=$N2r@O$N7k2L\e(B
105 \e$BJV$5$l$k!V\e(B@dfn{\e$B%O%s%I%k\e(B}\e$B!W\e(B \e$B$N%j%9%H$K4p$E$$$F!"B>$N%W%m%0%i%`$,J*;v$r9T\e(B
106 \e$B$J$&$3$H$r2DG=$K$9$k$3$H$G$9!#\e(B
107
108 @menu
109 * Dissection::             @acronym{MIME} \e$B%a%C%;!<%8$N2r@O\e(B
110 * Non-MIME::               \e$BHs\e(B-@acronym{MIME} \e$B%a%C%;!<%8$N2r@O\e(B
111 * Handles::                \e$B%O%s%I%k$N<h$j07$$\e(B
112 * Display::                \e$B%O%s%I%k$NI=<(\e(B
113 * Display Customization::  \e$BI=<($K1F6A$9$kJQ?t\e(B
114 * Files and Directories::  \e$BE:IU%U%!%$%k$NJ]B8$HL?L>\e(B
115 * New Viewers::            \e$B<+J,MQ%S%e!<%o!<$N=q$-J}\e(B
116 @end menu
117
118 @node Dissection
119 @section \e$B2rBN\e(B
120
121 @code{mm-dissect-buffer} \e$B$O\e(B @acronym{MIME} \e$B5-;v$N2rBN$rC4Ev$9$k4X?t$G$9!#\e(B
122 \e$B%^%k%A%Q!<%H$N%a%C%;!<%8$,M?$($i$l$k$H!"%a%C%;!<%8$r:F5"E*$K7!$j2<$2!"9=\e(B
123 \e$BB$$K=>$C$F!"$=$N%a%C%;!<%8$N9=B$$rIA<L$9$k\e(B @acronym{MIME} \e$B%O%s%I%k$NLZ9=\e(B
124 \e$BB$$rJV$7$^$9!#\e(B
125
126 @node Non-MIME
127 @section \e$BHs\e(B-MIME
128 @vindex mm-uu-configure-list
129
130 Gnus \e$B$O$$$/$D$+$NHs\e(B-@acronym{MIME} \e$B$NE:IU%U%!%$%k$bM}2r$7$^$9!#$=$l$i\e(B
131 \e$B$O\e(B postscript, uuencode, binhex, yenc, shar, forward, gnatsweb, pgp,
132 diff \e$B$N$h$&$J$b$N$G$9!#$=$l$>$l$N5!G=$O\e(B @code{mm-uu-configure-list} \e$B$K9`\e(B
133 \e$BL\$rDI2C$9$k$3$H$K$h$C$F!"L58z$K$9$k$3$H$,$G$-$^$9!#Nc$G$9!#\e(B
134
135 @lisp
136 (require 'mm-uu)
137 (add-to-list 'mm-uu-configure-list '(pgp-signed . disabled))
138 @end lisp
139
140 @table @code
141 @item postscript
142 @findex postscript
143 \e$B%]%9%H%9%/%j%W%H$N%U%!%$%k!#\e(B
144
145 @item uu
146 @findex uu
147 Uuencode \e$B$5$l$?%U%!%$%k!#\e(B
148
149 @item binhex
150 @findex binhex
151 Binhex \e$B$G%(%s%3!<%I$5$l$?%U%!%$%k!#\e(B
152
153 @item yenc
154 @findex yenc
155 Yenc \e$B$G%(%s%3!<%I$5$l$?%U%!%$%k!#\e(B
156
157 @item shar
158 @findex shar
159 Shar \e$B=q8K%U%!%$%k!#\e(B
160
161 @item forward
162 @findex forward
163 \e$BHs\e(B-@acronym{MIME} \e$B$GE>Aw$5$l$?%a%C%;!<%8!#\e(B
164
165 @item gnatsweb
166 @findex gnatsweb
167 Gnatsweb \e$B$NE:IU%U%!%$%k!#\e(B
168
169 @item pgp-signed
170 @findex pgp-signed
171 @acronym{PGP} \e$B$G=pL>$5$l$?J?J8\e(B (clear text)\e$B!#\e(B
172
173 @item pgp-encrypted
174 @findex pgp-encrypted
175 @acronym{PGP} \e$B$G0E9f2=$5$l$?J?J8\e(B (clear text)\e$B!#\e(B
176
177 @item pgp-key
178 @findex pgp-key
179 @acronym{PGP} \e$B$N8x3+80!#\e(B
180
181 @item emacs-sources
182 @findex emacs-sources
183 @vindex mm-uu-emacs-sources-regexp
184 Emacs \e$B$N%=!<%9%3!<%I!#$3$N9`L\$O\e(B @code{mm-uu-emacs-sources-regexp} \e$B$K9g\e(B
185 \e$BCW$9$k%0%k!<%W$G$N$_F0:n$7$^$9!#\e(B
186
187 @item diff
188 @vindex diff
189 @vindex mm-uu-diff-groups-regexp
190 \e$B%Q%C%A!#$3$l$O!"%3%_%C%H$5$l$?%U%!%$%k$N:9J,$,<+F0E*$KAw$i$l$k%0%k!<%W$r\e(B
191 \e$BBP>]$K$7$?$b$N$G$9!#\e(B@code{mm-uu-diff-groups-regexp} \e$B$K9gCW$9$k%0%k!<%W$G\e(B
192 \e$B$N$_F0:n$7$^$9!#\e(B
193 @end table
194
195 @node Handles
196 @section \e$B%O%s%I%k\e(B
197
198 @acronym{MIME} \e$B%O%s%I%k$O!"\e(B@acronym{MIME} \e$B$N9=@.MWAG$r40A4$K5-=R$9$k%j%9\e(B
199 \e$B%H$G$9!#\e(B
200
201 \e$B%O%s%I%k$NMWAG$r%"%/%;%9$9$k$?$a$K!"0J2<$N%^%/%m$r;H$&$3$H$,$G$-$^$9\e(B:
202
203 @table @code
204 @item mm-handle-buffer
205 @findex mm-handle-buffer
206 \e$B%G%3!<%I$5$l$F$$$J$$\e(B @acronym{MIME} \e$B%Q!<%H$NFbMFJ*$rJ];}$7$F$$$k%P%C%U%!\e(B
207 \e$B$rJV$7$^$9!#\e(B
208
209 @item mm-handle-type
210 @findex mm-handle-type
211 \e$B2r@O:Q$_$N!"%Q!<%H$N\e(B @code{Content-Type} \e$B$rJV$7$^$9!#\e(B
212
213 @item mm-handle-encoding
214 @findex mm-handle-encoding
215 \e$B%Q!<%H$N\e(B @code{Content-Transfer-Encoding} \e$B$rJV$7$^$9!#\e(B
216
217 @item mm-handle-undisplayer
218 @findex mm-handle-undisplayer
219 \e$BI=<($5$l$F$$$k%Q!<%H$r>C$9$3$H$,$G$-$k$b$N\e(B (\e$BLuCm\e(B: \e$B4X?t$J$I\e(B) \e$B$r\e(B (\e$B$=$l$,I=\e(B
220 \e$B<($5$l$F$$$k>l9g$K\e(B) \e$BJV$7$^$9!#\e(B
221
222 @item mm-handle-set-undisplayer
223 @findex mm-handle-set-undisplayer
224 \e$BI=<($5$l$F$$$k%Q!<%H$r>C$9$3$H$,$G$-$k$b$N\e(B (\e$BLuCm\e(B: \e$B4X?t$J$I\e(B) \e$B$r@_Dj$7$^$9!#\e(B
225
226 @item mm-handle-disposition
227 @findex mm-handle-disposition
228 \e$B2r@O:Q$_$N!"%Q!<%H$N\e(B @code{Content-Disposition} \e$B$rJV$7$^$9!#\e(B
229
230 @item mm-get-content-id
231 @code{Content-ID} \e$B$G;2>H$5$l$k%O%s%I%k\e(B (\e$BC1?t$^$?$OJ#?t\e(B) \e$B$rJV$7$^$9!#\e(B
232 @end table
233
234 @node Display
235 @section \e$BI=<(\e(B
236
237 \e$BI=<($7!">C5n$7!"J]B8$9$k$?$a$N4X?t!#\e(B
238
239 @table @code
240 @item mm-display-part
241 @findex mm-display-part
242 \e$B%Q!<%H$rI=<($7$^$9!#\e(B
243
244 @item mm-remove-part
245 @findex mm-remove-part
246 \e$B%Q!<%H$r\e(B (\e$B$=$l$,I=<($5$l$F$$$?$i\e(B) \e$B>C5n$7$^$9!#\e(B
247
248 @item mm-inlinable-p
249 @findex mm-inlinable-p
250 @acronym{MIME} \e$B%?%$%W$,%$%s%i%$%s$GI=<(2DG=$+$I$&$+$rJV$7$^$9!#\e(B
251
252 @item mm-automatic-display-p
253 @findex mm-automatic-display-p
254 @acronym{MIME} \e$B%?%$%W$,<+F0E*$KI=<($5$l$k$Y$-$+$I$&$+$rJV$7$^$9!#\e(B
255
256 @item mm-destroy-part
257 @findex mm-destroy-part
258 \e$B%Q!<%H$K$h$C$F;H$o$l$F$$$k$9$Y$F$N;q8;$r3+J|$7$^$9\e(B (\e$BLuCm\e(B: \e$B%Q!<%H$NI=<(!"\e(B
259 \e$B$*$h$S%Q!<%H$r2rBN$7$FF@$?8D!9$NItIJ$r0l;~E*$KJ];}$7$F$$$k%P%C%U%!$d%U%!\e(B
260 \e$B%$%k$r>C5n$7$^$9\e(B)\e$B!#\e(B
261
262 @item mm-save-part
263 @findex mm-save-part
264 \e$B%Q!<%H$r%U%!%$%k$KJ]B8$7$^$9!#\e(B
265
266 @item mm-pipe-part
267 @findex mm-pipe-part
268 \e$B%Q!<%H$r$"$k%W%m%;%9$K%Q%$%W$7$^$9!#\e(B
269
270 @item mm-interactively-view-part
271 @findex mm-interactively-view-part
272 \e$B%Q!<%H$rI=<($9$k$?$a$K;H$&\e(B mailcap \e$B$N<jCJ$r?R$M$^$9!#\e(B
273 @end table
274
275 @node Display Customization
276 @section \e$BI=<($N%+%9%?%^%$%:\e(B
277
278 @table @code
279 @item mm-inline-media-tests
280 @vindex mm-inline-media-tests
281 \e$B$3$l$OO"A[%j%9%H$G$9!#80\e(B (\e$BBh0lMWAG\e(B) \e$B$O\e(B @acronym{MIME} \e$B%?%$%W!"BhFsMWAG$O\e(B
282 \e$B%Q!<%H$r\e(B @dfn{\e$B%$%s%i%$%s\e(B} \e$B$G\e(B (\e$B$9$J$o$A\e(B Emacs \e$B$N2hLL$KKd$a9~$s$G\e(B) \e$BI=<($9\e(B
283 \e$B$k$?$a$N4X?t!"$=$7$FBh;0MWAG$O$=$N%Q!<%H$,%$%s%i%$%s$GI=<($9$k$3$H$,2DG=\e(B
284 \e$B$+$I$&$+$rD4$Y$k$?$a$KI>2A\e(B (@code{eval}) \e$B$5$l$k%U%)!<%`$G$9!#\e(B
285
286 \e$B$3$NJQ?t$O!"$"$k%Q!<%H$,%$%s%i%$%sI=<(2DG=$+$I$&$+$H!"$b$72DG=$J$i$=$N$d\e(B
287 \e$B$jJ}$r;XDj$7$^$9!#%Q!<%H$,8=<B$K%$%s%i%$%sI=<($5$l$F$$$k$+$I$&$+$r<($9$b\e(B
288 \e$B$N$G$O$"$j$^$;$s!#\e(B
289
290 @item mm-inlined-types
291 @vindex mm-inlined-types
292 \e$B0lJ}$3$l$O!">e5-$NJQ?t$K$h$C$F@_Dj$5$l$?>r7o$rK~B-$9$k!"%$%s%i%$%sI=<(2D\e(B
293 \e$BG=$J%?%$%W$r<($7$^$9!#$3$l$O\e(B @acronym{MIME} \e$B%a%G%#%"%?%$%W$N%j%9%H$G$9!#\e(B
294 (\e$BLuCm\e(B: \e$B$=$l$>$l$NMWAG$O@55,I=8=$G$9!#\e(B)
295
296 @item mm-automatic-display
297 @vindex mm-automatic-display
298 \e$B$3$l$O>e5-$NJQ?t$,G'$a$k%?%$%W$N$&$A$G!"!V<+F0E*!W$KI=<($5$l$k%?%$%W$N%j\e(B
299 \e$B%9%H$G$9!#$D$^$j!"%$%s%i%$%sI=<($,2DG=$J%Q!<%H$@$1$,<+F0E*$KI=<($5$l$^$9!#\e(B
300
301 @item mm-automatic-external-display
302 @vindex mm-automatic-external-display
303 \e$B$3$l$O30It%S%e!<%o!<$G<+F0E*$KI=<($5$l$k%?%$%W$N%j%9%H$G$9!#\e(B
304
305 @item mm-keep-viewer-alive-types
306 @vindex mm-keep-viewer-alive-types
307 \e$B$3$l$O!"JL$N5-;v$rA*Br$7$F$b!"30It%S%e!<%o!<$,\e(B kill \e$B$5$l$J$$%a%G%#%"%?%$\e(B
308 \e$B%W$N%j%9%H$G$9!#\e(B
309
310 \e$BLuCm\e(B: postscript \e$B$d\e(B dvi \e$B$J$I\e(B (\e$BJQ?t$N%G%#%U%)%k%HCM$r;2>H$N$3$H\e(B) \e$B$N$h$&$K!"\e(B
311 \e$BFI$`$N$K;~4V$,$+$+$k$+$b$7$l$J$$%Q!<%H$N%?%$%W$r4^$`%j%9%H$G$9!#0lJ}!"$3\e(B
312 \e$B$l$K4^$^$l$J$$C1=c$J2hA|$N%Q!<%H$J$I$O!"$=$l$,4^$^$l$F$$$?5-;v$NI=<($r$d\e(B
313 \e$B$a$?$H$-$K!"<+F0E*$K30It%S%e!<%o!<$,\e(B kill \e$B$5$l$^$9!#\e(B
314
315 @item mm-attachment-override-types
316 @vindex mm-attachment-override-types
317 \e$B$$$/$D$+$N\e(B @acronym{MIME} \e$B%(!<%8%'%s%H$O!"G[CV;X\e(B
318 \e$BDj\e(B (content-disposition) \e$B$H$7$F\e(B @samp{\e$BE:IU\e(B} (@samp{attachment}) \e$B%U%!%$%k\e(B
319 \e$B$G$"$k$3$H$r@_Dj$7$?%Q!<%H$r@8@.$7$^$9!#$3$NJQ?t$O$=$s$JG[CV;XDj$r>e=q$-\e(B
320 \e$B$7$F!"$=$N%Q!<%H$r%$%s%i%$%sI=<($9$k$3$H$r5v$7$^$9!#\e(B(\e$B$=$N%Q!<%H$N%$%s%i\e(B
321 \e$B%$%sI=<($9$k$3$H$,2DG=$G!";d$?$A$,$=$&$9$k$3$H$rK>$`>l9g$@$1!"G[CV;XDj$,\e(B
322 \e$B>e=q$-$5$l$k$3$H$KCm0U$7$F2<$5$$!#\e(B)
323
324 @item mm-discouraged-alternatives
325 @vindex mm-discouraged-alternatives
326 @samp{multipart/alternative} \e$B$rI=<($9$k$3$H$,7y$o$l$k\e(B @acronym{MIME} \e$B%?\e(B
327 \e$B%$%W$N%j%9%H$G$9!#$=$l$,:G$b6=L#?<$$$b$N$G$"$k$HA[Dj$7$F$$$k$?$a$K!"I=<(\e(B
328 \e$B%(!<%8%'%s%H$O%a%C%;!<%8$N8eH>$K$"$k2D;k$J%Q!<%H$rI=<($9$k$3$H$K$J$C$F$$\e(B
329 \e$B$^$9!#$7$+$7!"%f!<%6!<$OBe$o$j$KB>$N%?%$%W$r9%$`$+$b$7$l$^$;$s!#$3$N%j%9\e(B
330 \e$B%H$O!"2?$N%?%$%W$,:G$bK>$^$l$J$$$+$r<($7$^$9!#Nc$($P$b$7!"\e(B
331 @samp{text/html} \e$B%Q!<%H$OHs>o$KK>$^$:!"$+$D\e(B @samp{text/richtext} \e$B%Q!<%H\e(B
332 \e$B$r$d$dK>$^$J$$$H$$$&$3$H$G$"$l$P!"0J2<$N$h$&$K@k8@$9$k$3$H$,$G$-$^$9\e(B:
333
334 @lisp
335 (setq mm-discouraged-alternatives
336       '("text/html" "text/richtext")
337       mm-automatic-display
338       (remove "text/html" mm-automatic-display))
339 @end lisp
340
341 @item mm-inline-large-images
342 @vindex mm-inline-large-images
343 \e$B%&%#%s%I%&$h$jBg$-$J%$%s%i%$%s2hA|$rI=<($9$k$H!"\e(BEmacs \e$B$O%9%/%m!<%k$9$k$3\e(B
344 \e$B$H$,$G$-$J$$!"$D$^$j2hA|$NA4BN$r8+$k$3$H$,$G$-$^$;$s!#$3$l$rHr$1$k$?$a!"\e(B
345 \e$B%i%$%V%i%j!<$O$=$l$r%$%s%i%$%sI=<($9$kA0$K2hA|$N%5%$%:$r7W$C$F!"$=$l$,\e(B
346 \e$B%&%#%s%I%&$K9g$o$J$$>l9g$O!"%i%$%V%i%j!<$O$=$l$r30It$G\e(B (\e$BNc$(\e(B
347 \e$B$P\e(B @samp{ImageMagick} \e$B$d\e(B @samp{xv} \e$B$G\e(B) \e$BI=<($7$^$9!#$3$NJQ?t\e(B
348 \e$B$r\e(B @code{t} \e$B$K@_Dj$9$k$H$3$N8!::$r$5$;$J$/$7$F!"%i%$%V%i%j!<$K$9$Y$F$N%$\e(B
349 \e$B%s%i%$%s2hA|$r%5%$%:$K4X$o$j$J$/%$%s%i%$%s$GI=<($5$;$^$9!#\e(B
350
351 @item mm-inline-override-types
352 @vindex mm-inline-override-types
353 @code{mm-inlined-types} \e$B$O!"Nc$($P$9$Y$F$N\e(B @samp{text/.*} \e$B%Q!<%H$r%$%s%i\e(B
354 \e$B%$%s$GI=<($9$k$3$H$r;X<($9$k$h$&$J!"@55,I=8=$r4^$`$3$H$,$G$-$^$9!#0lJ}!"\e(B
355 \e$B%$%s%i%$%sI=<($,2DG=$@$1$l$I$bE:IU%U%!%$%k$H$7$F07$$$?$$%?%$%W$,$"$k$J$i\e(B
356 \e$B$P!"$=$N%?%$%W$K9gCW$9$k@55,I=8=$N%j%9%H$r!"$3$NJQ?t$K@_Dj$9$k$3$H$K$h$C\e(B
357 \e$B$F@.$7?k$2$k$3$H$,$G$-$^$9!#Nc$(\e(B
358 \e$B$P\e(B @code{mm-inlined-types} \e$B$,\e(B @samp{text/.*} \e$B$r4^$s$G$$$k$b$N$H$9$k$H!"\e(B
359 \e$B$3$NJQ?t$K\e(B @samp{text/html} \e$B$r4^$^$;$k$3$H$K$h$C$F!"\e(B@samp{text/html} \e$B%Q!<\e(B
360 \e$B%H$OE:IU%U%!%$%k$H$7$F07$o$l$k$h$&$K$J$j$^$9!#\e(B
361
362 @item mm-text-html-renderer
363 @vindex mm-text-html-renderer
364 @acronym{HTML} \e$B$rIA2h$9$k$?$a$K;H$&4X?t$rA*Br$7$^$9!#$9$G$KMQ0U$7$F$"$k\e(B
365 \e$BIA2h%W%m%0%i%`$O!"\e(B@code{w3}, @code{w3m}@footnote{emacs-w3m \e$B$K$D$$$F$N>\\e(B
366 \e$B:Y$O\e(B @uref{http://emacs-w3m.namazu.org/} \e$B$r8+$F2<$5$$!#\e(B}, @code{links},
367 @code{lynx}, @code{w3m-standalone} \e$B$^$?$O\e(B @code{html2text} \e$B$N%7%s%\%k72\e(B
368 \e$B$N$&$A$N0l$D$r;XDj$9$k$3$H$K$h$C$FA*Br$7$^$9!#$b$7\e(B @code{nil} \e$B$@$C$?$i!"\e(B
369 \e$B30It%S%e!<%o!<$r;H$$$^$9!#$5$i$K4X?t\e(B (\e$B0z?t$H$7$F\e(B @acronym{MIME} \e$B%O%s%I%k\e(B
370 \e$B$,M?$($i$l$F8F$P$l$k\e(B) \e$B$r@_Dj$9$k$3$H$b$G$-$^$9!#\e(B
371
372 @item mm-inline-text-html-with-images
373 @vindex mm-inline-text-html-with-images
374 @acronym{HTML} \e$B%a!<%k$K$O\e(B @samp{<img>} \e$B%?%0$r;H$C$?\e(B spammers (spam \e$B$r$P\e(B
375 \e$B$i$^$/$d$+$i\e(B) \e$B$NH\Nt$J0-9*$_$,4^$^$l$F$$$k$+$b$7$l$^$;$s!#:G$b$"$j$=$&$J\e(B
376 \e$B$N$O!"$"$J$?$,$=$N%a!<%k$rFI$s$@$3$H$r3NG'$9$k$?$a$N0U?^$,$"$k$3$H$G$9!#\e(B
377 \e$B$3$N%*%W%7%g%s$r\e(B @code{nil} \e$B$K@_Dj$9$k\e(B (\e$B$=$l$,%G%#%U%)%k%H$G$9\e(B) \e$B$3$H$K$h$C\e(B
378 \e$B$F!"$"$J$?$N8D?M>pJs$,N.=P$9$k$N$rKI$0$3$H$,$G$-$^$9!#8=:_\e(B Emacs/w3 \e$B$O!"\e(B
379 \e$B$3$l$rL5;k$7$^$9!#\e(BEmacs-w3m \e$B$G$O!"$3$l$,\e(B @code{nil} \e$B$G$"$C$F$b!"2hA|$rI=\e(B
380 \e$B<($9$k$?$a$K!"$=$l$,Kd$a9~$^$l$?>l=j$G\e(B @kbd{t} \e$B%3%^%s%I$r;H$&$3$H$,$G$-\e(B
381 \e$B$^$9!#\e(B@footnote{@kbd{T} \e$B%3%^%s%I$O$9$Y$F$N2hA|$r<h$j9~$_$^$9!#\e(B
382 @code{w3m-key-binding} \e$B%*%W%7%g%s$r\e(B @code{info} \e$B$K@_Dj$7$?$J$i$P!"Be$o$j\e(B
383 \e$B$K\e(B @kbd{i} \e$B$+\e(B @kbd{I} \e$B$r;H$C$F2<$5$$!#\e(B}
384
385 @item mm-w3m-safe-url-regexp
386 @vindex mm-w3m-safe-url-regexp
387 \e$B0BA4$J\e(B URL \e$BL>!"$9$J$o$A\e(B @acronym{HTML} \e$B%a!<%k$rIA2h$9$k$H$-$K8D?M>pJs$,\e(B
388 \e$BN.=P$7$=$&$b$J$$\e(B URL \e$B$K9gCW$9$k@55,I=8=$G$9\e(B (\e$B%G%#%U%)%k%HCM\e(B
389 \e$B$O\e(B @samp{\\`cid:} \e$B$G$9\e(B)\e$B!#\e(B@code{nil} \e$B$G$"$k$H!"$9$Y$F$N\e(B URL \e$B$,0BA4$@$HH=\e(B
390 \e$BCG$7$^$9!#\e(B
391
392 @item mm-inline-text-html-with-w3m-keymap
393 @vindex mm-inline-text-html-with-w3m-keymap
394 \e$B$3$N%*%W%7%g%s$rHs\e(B-@code{nil} \e$B$K@_Dj$9$k$3$H$K$h$C$F!"%$%s%i%$%sI=<($5$l\e(B
395 \e$B$?\e(B text/html \e$B%Q!<%H$G\e(B emacs-w3m \e$B$N%3%^%s%I%-!<$r;H$&$3$H$,$G$-$^$9!#%G%#\e(B
396 \e$B%U%)%k%HCM$O\e(B @code{t} \e$B$G$9!#\e(B
397
398 @item mm-external-terminal-program
399 @vindex mm-external-terminal-program
400 \e$B30It$NC<Kv$r5/F0$9$k$?$a$K;H$o$l$k%W%m%0%i%`$G$9!#\e(B
401
402 @item mm-enable-external
403 @vindex mm-enable-external
404 \e$B30It$N\e(B @acronym{MIME} \e$B%O%s%I%i!<$r;H$&$Y$-$+$I$&$+$r;XDj$7$^$9!#\e(B
405
406 @code{t} \e$B$G$"$k$H!"Dj5A$5$l$?$9$Y$F$N30It$N\e(B @acronym{MIME} \e$B%O%s%I%i!<$,\e(B
407 \e$B;H$o$l$^$9!#\e(B@code{nil} \e$B$@$C$?$i!"%U%!%$%k$O%G%#%9%/$KJ]B8$5$l$^\e(B
408 \e$B$9\e(B (@code{mailcap-save-binary-file})\e$B!#$3$l$,\e(B @code{ask} \e$B$H$$$&%7%s%\%k$G\e(B
409 \e$B$"$C$?$J$i$P!"30It$N\e(B @acronym{MIME} \e$B%O%s%I%i!<$,5/F0$5$l$kA0$K?R$M$i$l$k\e(B
410 \e$B$G$7$g$&!#\e(B
411
412 Mailcap (@pxref{mailcap}) \e$B$r2p$7$FE:IU%U%!%$%k$NI=<($r;O$a$k$H!":G$b0BA4\e(B
413 \e$B$J%*%W%7%g%s$G0BA4$J%S%e!<%o!<$r;H$&$3$H$r;n$_$^$9\e(B (\e$BE:IU%U%!%$%k$r%G%#%9\e(B
414 \e$B%/$KJ]B8$7$F!"0[$J$k<jCJ\e(B (\e$B%3%^%s%I%i%$%s$+%@%V%k%/%j%C%/\e(B) \e$B$G$=$NI=<($r;O\e(B
415 \e$B$a$k>l9g$H$O0c$$$^$9\e(B)\e$B!#$H$K$+$/!"$I$s$J30It%W%m%0%i%`$b;H$$$?$/$J$$$N$G\e(B
416 \e$B$"$l$P!"$3$NJQ?t$r\e(B @code{nil} \e$B$+\e(B @code{ask} \e$B$K@_Dj$7$F2<$5$$!#\e(B
417 @end table
418
419 @node Files and Directories
420 @section \e$B%U%!%$%k$H%G%#%l%/%H%j!<\e(B
421
422 @table @code
423 @item mm-default-directory
424 @vindex mm-default-directory
425 \e$BE:IU%U%!%$%k$rJ]B8$9$k%G%#%U%)%k%H$N%G%#%l%/%H%j!<$G$9!#\e(B@code{nil} \e$B$@$C\e(B
426 \e$B$?$i\e(B @code{default-directory} \e$B$r;H$$$^$9!#\e(B
427
428 @item mm-tmp-directory
429 @vindex mm-tmp-directory
430 \e$B0l;~%U%!%$%k$r3JG<$9$k%G%#%l%/%H%j!<$G$9!#\e(B
431
432 @item mm-file-name-rewrite-functions
433 @vindex mm-file-name-rewrite-functions
434 @acronym{MIME} \e$B%Q!<%H$N%U%!%$%kL>$r=q$-49$($k$?$a$K;H$o$l$k4X?t$N%j%9%H\e(B
435 \e$B$G$9!#$=$l$>$l$N4X?t$O%U%!%$%kL>$r<u$1<h$C$F!"%U%!%$%kL>$rJV$7$^$9!#=PMh\e(B
436 \e$B9g$$$N4X?t$O0J2<$NDL$j$G$9!#\e(B
437
438 @table @code
439 @item mm-file-name-delete-control
440 @findex mm-file-name-delete-control
441 \e$B$9$Y$F$N@)8fJ8;z$r>C5n$7$^$9!#\e(B
442
443 @item mm-file-name-delete-gotchas
444 @findex mm-file-name-delete-gotchas
445 \e$B<e$_$,$"$k%7%'%k%9%/%j%W%H$G;H$o$l$k$H0U?^$7$J$$7k2L$r@8$8$kJ8;z!"$9$J$o\e(B
446 \e$B$A\e(B @samp{|}, @samp{>} \e$B$*$h$S\e(B @samp{<}\e$B!"2C$($F:G=i$NJ8;z$H$7$F;H$o$l\e(B
447 \e$B$k\e(B @samp{-} \e$B$H\e(B @samp{.} \e$B$r>C5n$7$^$9!#\e(B
448
449 @item mm-file-name-delete-whitespace
450 @findex mm-file-name-delete-whitespace
451 \e$B$9$Y$F$N6uGrJ8;z$r<h$j=|$-$^$9!#\e(B
452
453 @item mm-file-name-trim-whitespace
454 @findex mm-file-name-trim-whitespace
455 \e$B@hF,$HKvHx$N6uGrJ8;z$r<h$j=|$-$^$9!#\e(B
456
457 @item mm-file-name-collapse-whitespace
458 @findex mm-file-name-collapse-whitespace
459 \e$BJ#?t$NO"B3$7$?6uGrJ8;z$rC10l$N%9%Z!<%9J8;z$GCV$-49$($^$9!#\e(B
460
461 @item mm-file-name-replace-whitespace
462 @findex mm-file-name-replace-whitespace
463 @vindex mm-file-name-replace-whitespace
464 \e$B6uGrJ8;z$r2<@~\e(B (underscores) \e$B$GCV$-49$($^$9!#2<@~$,$*9%$_$G$J$1$l$P!"B>\e(B
465 \e$B$NJ8;z$r\e(B @code{mm-file-name-replace-whitespace} \e$BJQ?t$K@_Dj$7$F2<$5$$!#\e(B
466 @end table
467
468 Emacs \e$BI8=`$N4X?t$G$"$k\e(B @code{capitalize}, @code{downcase},
469 @code{upcase} \e$B$*$h$S\e(B @code{upcase-initials} \e$B$b!"LrN)$D$3$H$OL@$i$+$G$9!#\e(B
470
471 @item mm-path-name-rewrite-functions
472 @vindex mm-path-name-rewrite-functions
473 @acronym{MIME} \e$B%Q!<%H$N%U%k!&%U%!%$%kL>$r=q$-49$($k$?$a$K;H$o$l$k4X?t$N\e(B
474 \e$B%j%9%H$G$9!#$3$l$O%Q!<%H$r30It$KI=<($9$k$H$-\e(B (\e$B$9$J$o$A!"M;DL$N8z$+$J$$%W\e(B
475 \e$B%m%0%i%`$,!"%U%!%$%k$,J]B8$5$l$?>l=j$r8+$D$1$k$3$H$,$G$-$k$h$&$K!"@dBP%Q\e(B
476 \e$B%9L>$rJQ49$9$k$?$a\e(B) \e$B$K;H$o$l$^$9!#\e(B
477 @end table
478
479 @node New Viewers
480 @section \e$B?7$7$$%S%e!<%o!<\e(B
481
482 \e$B$3$l$O\e(B @code{text/enriched} \e$B%Q!<%H$r%$%s%i%$%sI=<($9$k%S%e!<%o!<$NNc$G$9\e(B:
483
484 @lisp
485 (defun mm-display-enriched-inline (handle)
486   (let (text)
487     (with-temp-buffer
488       (mm-insert-part handle)
489       (save-window-excursion
490         (enriched-decode (point-min) (point-max))
491         (setq text (buffer-string))))
492     (mm-insert-inline handle text)))
493 @end lisp
494
495 \e$B$3$N4X?t$,%Q%i%a!<%?$H$7$F\e(B @acronym{MIME} \e$B%O%s%I%k$r<u$1<h$k$3$H$,$o$+$j\e(B
496 \e$B$^$9$M!#$=$l$O0l;~%P%C%U%!$K:n6H>l=j$r0\$7!"%Q!<%H$N%F%-%9%H$rA^F~$7!"$=\e(B
497 \e$B$N%F%-%9%H$K$"$k=hM}$r;\$7!"7k2L$r3P$($F$*$$$F!"4X?t$,8F$P$l$?$H$-$N%P%C\e(B
498 \e$B%U%!$KLa$C$F$=$N7k2L$rA^F~$7$^$9!#\e(B
499
500 \e$B$3$3$K$"$kFs$D$N=EMW$J$*=u$14X?t\e(B
501 \e$B$O\e(B @code{mm-insert-part} \e$B$H\e(B @code{mm-insert-inline} \e$B$G$9!#:G=i$N4X?t$O!"\e(B
502 \e$B%O%s%I%k$N%F%-%9%H$r8=:_$N%P%C%U%!$KA^F~$7$^$9!#$3$l$OJ8;z%;%C%H$*$h$S%(\e(B
503 \e$B%s%3!<%G%#%0\e(B (content transfer decoding) \e$B$r<h$j07$$$^$9!#FsHVL\$N4X?t$O!"\e(B
504 \e$BA^F~$7$m$H8@$C$?$I$s$J%F%-%9%H$G$bC1$KA^F~$7$^$9$,!"%F%-%9%H$r<j7Z$JJ}K!\e(B
505 \e$B$G!VI=<($5$l$J$/$9$k\e(B (undisplayed)\e$B!W$3$H$,$G$-$k$h$&$J=t@_Dj$r$b9T$J$$$^\e(B
506 \e$B$9!#\e(B
507
508 @node Composing
509 @chapter MIME \e$B%a%C%;!<%8$N:n@.\e(B
510 @cindex Composing
511 @cindex MIME Composing
512 @cindex MML
513 @cindex MIME Meta Language
514
515 @acronym{MIME} \e$B%a%C%;!<%8$N:n@.$OB`6~$J;E;v$@$74JC1$G$b$"$j$^$;$s!#$=$3\e(B
516 \e$B$G!"\e(B@acronym{MML} (@acronym{MIME} Meta Language) \e$B$H$$$&!"8@8l$r2r@O$7\e(B
517 \e$B$F\e(B @acronym{MIME} \e$B%a%C%;!<%8$r@8@.$9$k!"\e(B@code{mml} \e$B$H$$$&%i%$%V%i%j!<$,\e(B
518 \e$B:n$i$l$^$7$?!#\e(B
519
520 @findex mml-generate-mime
521 \e$B<gMW$J%$%s%?!<%U%'!<%94X?t$O\e(B @code{mml-generate-mime} \e$B$G$9!#$3$l$O8=:_\e(B
522 \e$B$N\e(B (\e$B69$a$i$l$?\e(B) \e$B%P%C%U%!$NFbMFJ*$rD4$Y$F!"\e(B@acronym{MIME} \e$B%a%C%;!<%8$r4^\e(B
523 \e$B$`J8;zNs$rJV$7$^$9!#\e(B
524
525 @menu
526 * Simple MML Example::             @acronym{MML} \e$BJ8=q$NNc\e(B
527 * MML Definition::                 \e$B$9$Y$F$NM-8z$J\e(B @acronym{MML} \e$BMWAG\e(B
528 * Advanced MML Example::           \e$B$b$&0l$D$N\e(B @acronym{MML} \e$BJ8=q$NNc\e(B
529 * Encoding Customization::         \e$B%(%s%3!<%G%#%s%0$K:nMQ$9$kJQ?t\e(B
530 * Charset Translation::            @sc{mule} \e$BJ8;z%;%C%H$+$i\e(B @acronym{MIME} \e$BJ8;z%;%C%H$X$N3d$jEv$F\e(B
531 * Conversion::                     @acronym{MIME} \e$B$+$i\e(B @acronym{MML} \e$B$X!"$*$h$S$=$N5U\e(B
532 * Flowed text::                    \e$B%=%U%H$*$h$S%O!<%I2~9T\e(B
533 @end menu
534
535 @node Simple MML Example
536 @section Simple MML Example
537
538 Here's a simple @samp{multipart/alternative}:
539
540 @example
541 <#multipart type=alternative>
542 This is a plain text part.
543 <#part type=text/enriched>
544 <center>This is a centered enriched part</center>
545 <#/multipart>
546 @end example
547
548 After running this through @code{mml-generate-mime}, we get this:
549
550 @example
551 Content-Type: multipart/alternative; boundary="=-=-="
552
553
554 --=-=-=
555
556
557 This is a plain text part.
558
559 --=-=-=
560 Content-Type: text/enriched
561
562
563 <center>This is a centered enriched part</center>
564
565 --=-=-=--
566 @end example
567
568
569 @node MML Definition
570 @section MML Definition
571
572 The @acronym{MML} language is very simple.  It looks a bit like an SGML
573 application, but it's not.
574
575 The main concept of @acronym{MML} is the @dfn{part}.  Each part can be of a
576 different type or use a different charset.  The way to delineate a part
577 is with a @samp{<#part ...>} tag.  Multipart parts can be introduced
578 with the @samp{<#multipart ...>} tag.  Parts are ended by the
579 @samp{<#/part>} or @samp{<#/multipart>} tags.  Parts started with the
580 @samp{<#part ...>} tags are also closed by the next open tag.
581
582 There's also the @samp{<#external ...>} tag.  These introduce
583 @samp{external/message-body} parts.
584
585 Each tag can contain zero or more parameters on the form
586 @samp{parameter=value}.  The values may be enclosed in quotation marks,
587 but that's not necessary unless the value contains white space.  So
588 @samp{filename=/home/user/#hello$^yes} is perfectly valid.
589
590 The following parameters have meaning in @acronym{MML}; parameters that have no
591 meaning are ignored.  The @acronym{MML} parameter names are the same as the
592 @acronym{MIME} parameter names; the things in the parentheses say which
593 header it will be used in.
594
595 @table @samp
596 @item type
597 The @acronym{MIME} type of the part (@code{Content-Type}).
598
599 @item filename
600 Use the contents of the file in the body of the part
601 (@code{Content-Disposition}).
602
603 @item charset
604 The contents of the body of the part are to be encoded in the character
605 set specified (@code{Content-Type}). @xref{Charset Translation}.
606
607 @item name
608 Might be used to suggest a file name if the part is to be saved
609 to a file (@code{Content-Type}).
610
611 @item disposition
612 Valid values are @samp{inline} and @samp{attachment}
613 (@code{Content-Disposition}).
614
615 @item encoding
616 Valid values are @samp{7bit}, @samp{8bit}, @samp{quoted-printable} and
617 @samp{base64} (@code{Content-Transfer-Encoding}). @xref{Charset
618 Translation}.
619
620 @item description
621 A description of the part (@code{Content-Description}).
622
623 @item creation-date
624 RFC822 date when the part was created (@code{Content-Disposition}).
625
626 @item modification-date
627 RFC822 date when the part was modified (@code{Content-Disposition}).
628
629 @item read-date
630 RFC822 date when the part was read (@code{Content-Disposition}).
631
632 @item recipients
633 Who to encrypt/sign the part to.  This field is used to override any
634 auto-detection based on the To/CC headers.
635
636 @item sender
637 Identity used to sign the part.  This field is used to override the
638 default key used.
639
640 @item size
641 The size (in octets) of the part (@code{Content-Disposition}).
642
643 @item sign
644 What technology to sign this @acronym{MML} part with (@code{smime}, @code{pgp}
645 or @code{pgpmime})
646
647 @item encrypt
648 What technology to encrypt this @acronym{MML} part with (@code{smime},
649 @code{pgp} or @code{pgpmime})
650
651 @end table
652
653 Parameters for @samp{text/plain}:
654
655 @table @samp
656 @item format
657 Formatting parameter for the text, valid values include @samp{fixed}
658 (the default) and @samp{flowed}.  Normally you do not specify this
659 manually, since it requires the textual body to be formatted in a
660 special way described in RFC 2646.  @xref{Flowed text}.
661 @end table
662
663 Parameters for @samp{application/octet-stream}:
664
665 @table @samp
666 @item type
667 Type of the part; informal---meant for human readers
668 (@code{Content-Type}).
669 @end table
670
671 Parameters for @samp{message/external-body}:
672
673 @table @samp
674 @item access-type
675 A word indicating the supported access mechanism by which the file may
676 be obtained.  Values include @samp{ftp}, @samp{anon-ftp}, @samp{tftp},
677 @samp{localfile}, and @samp{mailserver}.  (@code{Content-Type}.)
678
679 @item expiration
680 The RFC822 date after which the file may no longer be fetched.
681 (@code{Content-Type}.)
682
683 @item size
684 The size (in octets) of the file.  (@code{Content-Type}.)
685
686 @item permission
687 Valid values are @samp{read} and @samp{read-write}
688 (@code{Content-Type}).
689
690 @end table
691
692 Parameters for @samp{sign=smime}:
693
694 @table @samp
695
696 @item keyfile
697 File containing key and certificate for signer.
698
699 @end table
700
701 Parameters for @samp{encrypt=smime}:
702
703 @table @samp
704
705 @item certfile
706 File containing certificate for recipient.
707
708 @end table
709
710
711 @node Advanced MML Example
712 @section Advanced MML Example
713
714 Here's a complex multipart message.  It's a @samp{multipart/mixed} that
715 contains many parts, one of which is a @samp{multipart/alternative}.
716
717 @example
718 <#multipart type=mixed>
719 <#part type=image/jpeg filename=~/rms.jpg disposition=inline>
720 <#multipart type=alternative>
721 This is a plain text part.
722 <#part type=text/enriched name=enriched.txt>
723 <center>This is a centered enriched part</center>
724 <#/multipart>
725 This is a new plain text part.
726 <#part disposition=attachment>
727 This plain text part is an attachment.
728 <#/multipart>
729 @end example
730
731 And this is the resulting @acronym{MIME} message:
732
733 @example
734 Content-Type: multipart/mixed; boundary="=-=-="
735
736
737 --=-=-=
738
739
740
741 --=-=-=
742 Content-Type: image/jpeg;
743  filename="~/rms.jpg"
744 Content-Disposition: inline;
745  filename="~/rms.jpg"
746 Content-Transfer-Encoding: base64
747
748 /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
749 Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/wAALCAAwADABAREA/8QAHwAA
750 AQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQR
751 BRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RF
752 RkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ip
753 qrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9oACAEB
754 AAA/AO/rifFHjldNuGsrDa0qcSSHkA+gHrXKw+LtWLrMb+RgTyhbr+HSug07xNqV9fQtZrNI
755 AyiaE/NuBPOOOP0rvRNE880KOC8TbXXGCv1FPqjrF4LDR7u5L7SkTFT/ALWOP1xXgTuXfc7E
756 sx6nua6rwp4IvvEM8chCxWxOdzn7wz6V9AaB4S07w9p5itow0rDLSY5Pt9K43xO66P4xs71m
757 2QXiGCbA4yOVJ9+1aYORkdK434lyNH4ahCnG66VT9Nj15JFbPdX0MS43M4VQf5/yr2vSpLnw
758 5ZW8dlCZ8KFXjOPX0/mK6rSPEGt3Angu44fNEReHYNvIH3TzXDeKNO8RX+kSX2ouZkicTIOc
759 L+g7E810ulFjpVtv3bwgB3HJyK5L4quY/C9sVxk3ij/xx6850u7t1mtp/wDlpEw3An3Jr3Dw
760 34gsbWza4nBlhC5LDsaW6+IFgupQyCF3iHH7gA7c9R9ay7zx6t7aX9jHC4smhfBkGCvHGfrm
761 tLQ7hbnRrV1GPkAP1x1/Hr+Ncr8Vzjwrbf8AX6v/AKA9eQRyYlQk8Yx9K6XTNbkgia2ciSIn
762 7p5Ga9Atte0LTLKO6it4i7dVRFJDcZ4PvXN+JvEMF9bILVGXJLSZ4zkjivRPDaeX4b08HOTC
763 pOffmua+KkbS+GLVUGT9tT/0B68eeIpIFYjB70+OOVXyoOM9+M1eaWeCLzHPyHGO/NVWvJJm
764 jQ8KGH1NfQWhXSXmh2c8eArRLwO3HSv/2Q==
765
766 --=-=-=
767 Content-Type: multipart/alternative; boundary="==-=-="
768
769
770 --==-=-=
771
772
773 This is a plain text part.
774
775 --==-=-=
776 Content-Type: text/enriched;
777  name="enriched.txt"
778
779
780 <center>This is a centered enriched part</center>
781
782 --==-=-=--
783
784 --=-=-=
785
786 This is a new plain text part.
787
788 --=-=-=
789 Content-Disposition: attachment
790
791
792 This plain text part is an attachment.
793
794 --=-=-=--
795 @end example
796
797 @node Encoding Customization
798 @section Encoding Customization
799
800 @table @code
801
802 @item mm-body-charset-encoding-alist
803 @vindex mm-body-charset-encoding-alist
804 Mapping from @acronym{MIME} charset to encoding to use.  This variable is
805 usually used except, e.g., when other requirements force a specific
806 encoding (digitally signed messages require 7bit encodings).  The
807 default is
808
809 @lisp
810 ((iso-2022-jp . 7bit)
811  (iso-2022-jp-2 . 7bit)
812  (utf-16 . base64)
813  (utf-16be . base64)
814  (utf-16le . base64))
815 @end lisp
816
817 As an example, if you do not want to have ISO-8859-1 characters
818 quoted-printable encoded, you may add @code{(iso-8859-1 . 8bit)} to
819 this variable.  You can override this setting on a per-message basis
820 by using the @code{encoding} @acronym{MML} tag (@pxref{MML Definition}).
821
822 @item mm-coding-system-priorities
823 @vindex mm-coding-system-priorities
824 Prioritize coding systems to use for outgoing messages.  The default
825 is @code{nil}, which means to use the defaults in Emacs.  It is a list of
826 coding system symbols (aliases of coding systems are also allowed, use
827 @kbd{M-x describe-coding-system} to make sure you are specifying correct
828 coding system names).  For example, if you have configured Emacs
829 to prefer UTF-8, but wish that outgoing messages should be sent in
830 ISO-8859-1 if possible, you can set this variable to
831 @code{(iso-8859-1)}.  You can override this setting on a per-message
832 basis by using the @code{charset} @acronym{MML} tag (@pxref{MML Definition}).
833
834 @item mm-content-transfer-encoding-defaults
835 @vindex mm-content-transfer-encoding-defaults
836 Mapping from @acronym{MIME} types to encoding to use.  This variable is usually
837 used except, e.g., when other requirements force a safer encoding
838 (digitally signed messages require 7bit encoding).  Besides the normal
839 @acronym{MIME} encodings, @code{qp-or-base64} may be used to indicate that for
840 each case the most efficient of quoted-printable and base64 should be
841 used.
842
843 @code{qp-or-base64} has another effect.  It will fold long lines so that
844 MIME parts may not be broken by MTA.  So do @code{quoted-printable} and
845 @code{base64}.
846
847 Note that it affects body encoding only when a part is a raw forwarded
848 message (which will be made by @code{gnus-summary-mail-forward} with the
849 arg 2 for example) or is neither the @samp{text/*} type nor the
850 @samp{message/*} type.  Even though in those cases, you can override
851 this setting on a per-message basis by using the @code{encoding}
852 @acronym{MML} tag (@pxref{MML Definition}).
853
854 @item mm-use-ultra-safe-encoding
855 @vindex mm-use-ultra-safe-encoding
856 When this is non-@code{nil}, it means that textual parts are encoded as
857 quoted-printable if they contain lines longer than 76 characters or
858 starting with "From " in the body.  Non-7bit encodings (8bit, binary)
859 are generally disallowed.  This reduce the probability that a non-8bit
860 clean MTA or MDA changes the message.  This should never be set
861 directly, but bound by other functions when necessary (e.g., when
862 encoding messages that are to be digitally signed).
863
864 @end table
865
866 @node Charset Translation
867 @section Charset Translation
868 @cindex charsets
869
870 During translation from @acronym{MML} to @acronym{MIME}, for each
871 @acronym{MIME} part which has been composed inside Emacs, an appropriate
872 charset has to be chosen.
873
874 @vindex mail-parse-charset
875 If you are running a non-@sc{mule} Emacs, this process is simple: If the
876 part contains any non-@acronym{ASCII} (8-bit) characters, the @acronym{MIME} charset
877 given by @code{mail-parse-charset} (a symbol) is used.  (Never set this
878 variable directly, though.  If you want to change the default charset,
879 please consult the documentation of the package which you use to process
880 @acronym{MIME} messages.
881 @xref{Various Message Variables, , Various Message Variables, message,
882       Message Manual}, for example.)
883 If there are only @acronym{ASCII} characters, the @acronym{MIME} charset US-ASCII is
884 used, of course.
885
886 @cindex MULE
887 @cindex UTF-8
888 @cindex Unicode
889 @vindex mm-mime-mule-charset-alist
890 Things are slightly more complicated when running Emacs with @sc{mule}
891 support.  In this case, a list of the @sc{mule} charsets used in the
892 part is obtained, and the @sc{mule} charsets are translated to @acronym{MIME}
893 charsets by consulting the variable @code{mm-mime-mule-charset-alist}.
894 If this results in a single @acronym{MIME} charset, this is used to encode
895 the part.  But if the resulting list of @acronym{MIME} charsets contains more
896 than one element, two things can happen: If it is possible to encode the
897 part via UTF-8, this charset is used.  (For this, Emacs must support
898 the @code{utf-8} coding system, and the part must consist entirely of
899 characters which have Unicode counterparts.)  If UTF-8 is not available
900 for some reason, the part is split into several ones, so that each one
901 can be encoded with a single @acronym{MIME} charset.  The part can only be
902 split at line boundaries, though---if more than one @acronym{MIME} charset is
903 required to encode a single line, it is not possible to encode the part.
904
905 When running Emacs with @sc{mule} support, the preferences for which
906 coding system to use is inherited from Emacs itself.  This means that
907 if Emacs is set up to prefer UTF-8, it will be used when encoding
908 messages.  You can modify this by altering the
909 @code{mm-coding-system-priorities} variable though (@pxref{Encoding
910 Customization}).
911
912 The charset to be used can be overridden by setting the @code{charset}
913 @acronym{MML} tag (@pxref{MML Definition}) when composing the message.
914
915 The encoding of characters (quoted-printable, 8bit etc) is orthogonal
916 to the discussion here, and is controlled by the variables
917 @code{mm-body-charset-encoding-alist} and
918 @code{mm-content-transfer-encoding-defaults} (@pxref{Encoding
919 Customization}).
920
921 @node Conversion
922 @section Conversion
923
924 @findex mime-to-mml
925 A (multipart) @acronym{MIME} message can be converted to @acronym{MML}
926 with the @code{mime-to-mml} function.  It works on the message in the
927 current buffer, and substitutes @acronym{MML} markup for @acronym{MIME}
928 boundaries.  Non-textual parts do not have their contents in the buffer,
929 but instead have the contents in separate buffers that are referred to
930 from the @acronym{MML} tags.
931
932 @findex mml-to-mime
933 An @acronym{MML} message can be converted back to @acronym{MIME} by the
934 @code{mml-to-mime} function.
935
936 These functions are in certain senses ``lossy''---you will not get back
937 an identical message if you run @code{mime-to-mml} and then
938 @code{mml-to-mime}.  Not only will trivial things like the order of the
939 headers differ, but the contents of the headers may also be different.
940 For instance, the original message may use base64 encoding on text,
941 while @code{mml-to-mime} may decide to use quoted-printable encoding, and
942 so on.
943
944 In essence, however, these two functions should be the inverse of each
945 other.  The resulting contents of the message should remain equivalent,
946 if not identical.
947
948
949 @node Flowed text
950 @section Flowed text
951 @cindex format=flowed
952
953 The Emacs @acronym{MIME} library will respect the @code{use-hard-newlines}
954 variable (@pxref{Hard and Soft Newlines, ,Hard and Soft Newlines,
955 emacs, Emacs Manual}) when encoding a message, and the
956 ``format=flowed'' Content-Type parameter when decoding a message.
957
958 On encoding text, regardless of @code{use-hard-newlines}, lines
959 terminated by soft newline characters are filled together and wrapped
960 after the column decided by @code{fill-flowed-encode-column}.
961 Quotation marks (matching @samp{^>* ?}) are respected.  The variable
962 controls how the text will look in a client that does not support
963 flowed text, the default is to wrap after 66 characters.  If hard
964 newline characters are not present in the buffer, no flow encoding
965 occurs.
966
967 On decoding flowed text, lines with soft newline characters are filled
968 together and wrapped after the column decided by
969 @code{fill-flowed-display-column}.  The default is to wrap after
970 @code{fill-column}.
971
972 @table @code
973 @item mm-fill-flowed
974 @vindex mm-fill-flowed
975 If non-@code{nil} a format=flowed article will be displayed flowed.
976 @end table
977
978
979 @node Interface Functions
980 @chapter Interface Functions
981 @cindex interface functions
982 @cindex mail-parse
983
984 The @code{mail-parse} library is an abstraction over the actual
985 low-level libraries that are described in the next chapter.
986
987 Standards change, and so programs have to change to fit in the new
988 mold.  For instance, RFC2045 describes a syntax for the
989 @code{Content-Type} header that only allows @acronym{ASCII} characters in the
990 parameter list.  RFC2231 expands on RFC2045 syntax to provide a scheme
991 for continuation headers and non-@acronym{ASCII} characters.
992
993 The traditional way to deal with this is just to update the library
994 functions to parse the new syntax.  However, this is sometimes the wrong
995 thing to do.  In some instances it may be vital to be able to understand
996 both the old syntax as well as the new syntax, and if there is only one
997 library, one must choose between the old version of the library and the
998 new version of the library.
999
1000 The Emacs @acronym{MIME} library takes a different tack.  It defines a
1001 series of low-level libraries (@file{rfc2047.el}, @file{rfc2231.el}
1002 and so on) that parses strictly according to the corresponding
1003 standard.  However, normal programs would not use the functions
1004 provided by these libraries directly, but instead use the functions
1005 provided by the @code{mail-parse} library.  The functions in this
1006 library are just aliases to the corresponding functions in the latest
1007 low-level libraries.  Using this scheme, programs get a consistent
1008 interface they can use, and library developers are free to create
1009 write code that handles new standards.
1010
1011 The following functions are defined by this library:
1012
1013 @table @code
1014 @item mail-header-parse-content-type
1015 @findex mail-header-parse-content-type
1016 Parse a @code{Content-Type} header and return a list on the following
1017 format:
1018
1019 @lisp
1020 ("type/subtype"
1021  (attribute1 . value1)
1022  (attribute2 . value2)
1023  ...)
1024 @end lisp
1025
1026 Here's an example:
1027
1028 @example
1029 (mail-header-parse-content-type
1030  "image/gif; name=\"b980912.gif\"")
1031 @result{} ("image/gif" (name . "b980912.gif"))
1032 @end example
1033
1034 @item mail-header-parse-content-disposition
1035 @findex mail-header-parse-content-disposition
1036 Parse a @code{Content-Disposition} header and return a list on the same
1037 format as the function above.
1038
1039 @item mail-content-type-get
1040 @findex mail-content-type-get
1041 Takes two parameters---a list on the format above, and an attribute.
1042 Returns the value of the attribute.
1043
1044 @example
1045 (mail-content-type-get
1046  '("image/gif" (name . "b980912.gif")) 'name)
1047 @result{} "b980912.gif"
1048 @end example
1049
1050 @item mail-header-encode-parameter
1051 @findex mail-header-encode-parameter
1052 Takes a parameter string and returns an encoded version of the string.
1053 This is used for parameters in headers like @code{Content-Type} and
1054 @code{Content-Disposition}.
1055
1056 @item mail-header-remove-comments
1057 @findex mail-header-remove-comments
1058 Return a comment-free version of a header.
1059
1060 @example
1061 (mail-header-remove-comments
1062  "Gnus/5.070027 (Pterodactyl Gnus v0.27) (Finnish Landrace)")
1063 @result{} "Gnus/5.070027  "
1064 @end example
1065
1066 @item mail-header-remove-whitespace
1067 @findex mail-header-remove-whitespace
1068 Remove linear white space from a header.  Space inside quoted strings
1069 and comments is preserved.
1070
1071 @example
1072 (mail-header-remove-whitespace
1073  "image/gif; name=\"Name with spaces\"")
1074 @result{} "image/gif;name=\"Name with spaces\""
1075 @end example
1076
1077 @item mail-header-get-comment
1078 @findex mail-header-get-comment
1079 Return the last comment in a header.
1080
1081 @example
1082 (mail-header-get-comment
1083  "Gnus/5.070027 (Pterodactyl Gnus v0.27) (Finnish Landrace)")
1084 @result{} "Finnish Landrace"
1085 @end example
1086
1087 @item mail-header-parse-address
1088 @findex mail-header-parse-address
1089 Parse an address and return a list containing the mailbox and the
1090 plaintext name.
1091
1092 @example
1093 (mail-header-parse-address
1094  "Hrvoje Niksic <hniksic@@srce.hr>")
1095 @result{} ("hniksic@@srce.hr" . "Hrvoje Niksic")
1096 @end example
1097
1098 @item mail-header-parse-addresses
1099 @findex mail-header-parse-addresses
1100 Parse a string with list of addresses and return a list of elements like
1101 the one described above.
1102
1103 @example
1104 (mail-header-parse-addresses
1105  "Hrvoje Niksic <hniksic@@srce.hr>, Steinar Bang <sb@@metis.no>")
1106 @result{} (("hniksic@@srce.hr" . "Hrvoje Niksic")
1107      ("sb@@metis.no" . "Steinar Bang"))
1108 @end example
1109
1110 @item mail-header-parse-date
1111 @findex mail-header-parse-date
1112 Parse a date string and return an Emacs time structure.
1113
1114 @item mail-narrow-to-head
1115 @findex mail-narrow-to-head
1116 Narrow the buffer to the header section of the buffer.  Point is placed
1117 at the beginning of the narrowed buffer.
1118
1119 @item mail-header-narrow-to-field
1120 @findex mail-header-narrow-to-field
1121 Narrow the buffer to the header under point.  Understands continuation
1122 headers.
1123
1124 @item mail-header-fold-field
1125 @findex mail-header-fold-field
1126 Fold the header under point.
1127
1128 @item mail-header-unfold-field
1129 @findex mail-header-unfold-field
1130 Unfold the header under point.
1131
1132 @item mail-header-field-value
1133 @findex mail-header-field-value
1134 Return the value of the field under point.
1135
1136 @item mail-encode-encoded-word-region
1137 @findex mail-encode-encoded-word-region
1138 Encode the non-@acronym{ASCII} words in the region.  For instance,
1139 @samp{Na@"{@dotless{i}}ve} is encoded as @samp{=?iso-8859-1?q?Na=EFve?=}.
1140
1141 @item mail-encode-encoded-word-buffer
1142 @findex mail-encode-encoded-word-buffer
1143 Encode the non-@acronym{ASCII} words in the current buffer.  This function is
1144 meant to be called narrowed to the headers of a message.
1145
1146 @item mail-encode-encoded-word-string
1147 @findex mail-encode-encoded-word-string
1148 Encode the words that need encoding in a string, and return the result.
1149
1150 @example
1151 (mail-encode-encoded-word-string
1152  "This is na@"{@dotless{i}}ve, baby")
1153 @result{} "This is =?iso-8859-1?q?na=EFve,?= baby"
1154 @end example
1155
1156 @item mail-decode-encoded-word-region
1157 @findex mail-decode-encoded-word-region
1158 Decode the encoded words in the region.
1159
1160 @item mail-decode-encoded-word-string
1161 @findex mail-decode-encoded-word-string
1162 Decode the encoded words in the string and return the result.
1163
1164 @example
1165 (mail-decode-encoded-word-string
1166  "This is =?iso-8859-1?q?na=EFve,?= baby")
1167 @result{} "This is na@"{@dotless{i}}ve, baby"
1168 @end example
1169
1170 @end table
1171
1172 Currently, @code{mail-parse} is an abstraction over @code{ietf-drums},
1173 @code{rfc2047}, @code{rfc2045} and @code{rfc2231}.  These are documented
1174 in the subsequent sections.
1175
1176
1177
1178 @node Basic Functions
1179 @chapter Basic Functions
1180
1181 This chapter describes the basic, ground-level functions for parsing and
1182 handling.  Covered here is parsing @code{From} lines, removing comments
1183 from header lines, decoding encoded words, parsing date headers and so
1184 on.  High-level functionality is dealt with in the next chapter
1185 (@pxref{Decoding and Viewing}).
1186
1187 @menu
1188 * rfc2045::      Encoding @code{Content-Type} headers.
1189 * rfc2231::      Parsing @code{Content-Type} headers.
1190 * ietf-drums::   Handling mail headers defined by RFC822bis.
1191 * rfc2047::      En/decoding encoded words in headers.
1192 * time-date::    Functions for parsing dates and manipulating time.
1193 * qp::           Quoted-Printable en/decoding.
1194 * base64::       Base64 en/decoding.
1195 * binhex::       Binhex decoding.
1196 * uudecode::     Uuencode decoding.
1197 * yenc::         Yenc decoding.
1198 * rfc1843::      Decoding HZ-encoded text.
1199 * mailcap::      How parts are displayed is specified by the @file{.mailcap} file
1200 @end menu
1201
1202
1203 @node rfc2045
1204 @section rfc2045
1205
1206 RFC2045 is the ``main'' @acronym{MIME} document, and as such, one would
1207 imagine that there would be a lot to implement.  But there isn't, since
1208 most of the implementation details are delegated to the subsequent
1209 RFCs.
1210
1211 So @file{rfc2045.el} has only a single function:
1212
1213 @table @code
1214 @item rfc2045-encode-string
1215 @findex rfc2045-encode-string
1216 Takes a parameter and a value and returns a @samp{PARAM=VALUE} string.
1217 @var{value} will be quoted if there are non-safe characters in it.
1218 @end table
1219
1220
1221 @node rfc2231
1222 @section rfc2231
1223
1224 RFC2231 defines a syntax for the @code{Content-Type} and
1225 @code{Content-Disposition} headers.  Its snappy name is @dfn{MIME
1226 Parameter Value and Encoded Word Extensions: Character Sets, Languages,
1227 and Continuations}.
1228
1229 In short, these headers look something like this:
1230
1231 @example
1232 Content-Type: application/x-stuff;
1233  title*0*=us-ascii'en'This%20is%20even%20more%20;
1234  title*1*=%2A%2A%2Afun%2A%2A%2A%20;
1235  title*2="isn't it!"
1236 @end example
1237
1238 They usually aren't this bad, though.
1239
1240 The following functions are defined by this library:
1241
1242 @table @code
1243 @item rfc2231-parse-string
1244 @findex rfc2231-parse-string
1245 Parse a @code{Content-Type} header and return a list describing its
1246 elements.
1247
1248 @example
1249 (rfc2231-parse-string
1250  "application/x-stuff;
1251  title*0*=us-ascii'en'This%20is%20even%20more%20;
1252  title*1*=%2A%2A%2Afun%2A%2A%2A%20;
1253  title*2=\"isn't it!\"")
1254 @result{} ("application/x-stuff"
1255     (title . "This is even more ***fun*** isn't it!"))
1256 @end example
1257
1258 @item rfc2231-get-value
1259 @findex rfc2231-get-value
1260 Takes one of the lists on the format above and returns
1261 the value of the specified attribute.
1262
1263 @item rfc2231-encode-string
1264 @findex rfc2231-encode-string
1265 Encode a parameter in headers likes @code{Content-Type} and
1266 @code{Content-Disposition}.
1267
1268 @end table
1269
1270
1271 @node ietf-drums
1272 @section ietf-drums
1273
1274 @dfn{drums} is an IETF working group that is working on the replacement
1275 for RFC822.
1276
1277 The functions provided by this library include:
1278
1279 @table @code
1280 @item ietf-drums-remove-comments
1281 @findex ietf-drums-remove-comments
1282 Remove the comments from the argument and return the results.
1283
1284 @item ietf-drums-remove-whitespace
1285 @findex ietf-drums-remove-whitespace
1286 Remove linear white space from the string and return the results.
1287 Spaces inside quoted strings and comments are left untouched.
1288
1289 @item ietf-drums-get-comment
1290 @findex ietf-drums-get-comment
1291 Return the last most comment from the string.
1292
1293 @item ietf-drums-parse-address
1294 @findex ietf-drums-parse-address
1295 Parse an address string and return a list that contains the mailbox and
1296 the plain text name.
1297
1298 @item ietf-drums-parse-addresses
1299 @findex ietf-drums-parse-addresses
1300 Parse a string that contains any number of comma-separated addresses and
1301 return a list that contains mailbox/plain text pairs.
1302
1303 @item ietf-drums-parse-date
1304 @findex ietf-drums-parse-date
1305 Parse a date string and return an Emacs time structure.
1306
1307 @item ietf-drums-narrow-to-header
1308 @findex ietf-drums-narrow-to-header
1309 Narrow the buffer to the header section of the current buffer.
1310
1311 @end table
1312
1313
1314 @node rfc2047
1315 @section rfc2047
1316
1317 RFC2047 (Message Header Extensions for Non-@acronym{ASCII} Text) specifies how
1318 non-@acronym{ASCII} text in headers are to be encoded.  This is actually rather
1319 complicated, so a number of variables are necessary to tweak what this
1320 library does.
1321
1322 The following variables are tweakable:
1323
1324 @table @code
1325 @item rfc2047-header-encoding-alist
1326 @vindex rfc2047-header-encoding-alist
1327 This is an alist of header / encoding-type pairs.  Its main purpose is
1328 to prevent encoding of certain headers.
1329
1330 The keys can either be header regexps, or @code{t}.
1331
1332 The values can be @code{nil}, in which case the header(s) in question
1333 won't be encoded, @code{mime}, which means that they will be encoded, or
1334 @code{address-mime}, which means the header(s) will be encoded carefully
1335 assuming they contain addresses.
1336
1337 @item rfc2047-charset-encoding-alist
1338 @vindex rfc2047-charset-encoding-alist
1339 RFC2047 specifies two forms of encoding---@code{Q} (a
1340 Quoted-Printable-like encoding) and @code{B} (base64).  This alist
1341 specifies which charset should use which encoding.
1342
1343 @item rfc2047-encode-function-alist
1344 @vindex rfc2047-encode-function-alist
1345 This is an alist of encoding / function pairs.  The encodings are
1346 @code{Q}, @code{B} and @code{nil}.
1347
1348 @item rfc2047-encoded-word-regexp
1349 @vindex rfc2047-encoded-word-regexp
1350 When decoding words, this library looks for matches to this regexp.
1351
1352 @item rfc2047-encode-encoded-words
1353 @vindex rfc2047-encode-encoded-words
1354 The boolean variable specifies whether encoded words
1355 (e.g. @samp{=?hello?=}) should be encoded again.
1356
1357 @end table
1358
1359 Those were the variables, and these are this functions:
1360
1361 @table @code
1362 @item rfc2047-narrow-to-field
1363 @findex rfc2047-narrow-to-field
1364 Narrow the buffer to the header on the current line.
1365
1366 @item rfc2047-encode-message-header
1367 @findex rfc2047-encode-message-header
1368 Should be called narrowed to the header of a message.  Encodes according
1369 to @code{rfc2047-header-encoding-alist}.
1370
1371 @item rfc2047-encode-region
1372 @findex rfc2047-encode-region
1373 Encodes all encodable words in the region specified.
1374
1375 @item rfc2047-encode-string
1376 @findex rfc2047-encode-string
1377 Encode a string and return the results.
1378
1379 @item rfc2047-decode-region
1380 @findex rfc2047-decode-region
1381 Decode the encoded words in the region.
1382
1383 @item rfc2047-decode-string
1384 @findex rfc2047-decode-string
1385 Decode a string and return the results.
1386
1387 @item rfc2047-encode-parameter
1388 @findex rfc2047-encode-parameter
1389 Encode a parameter in the RFC2047-like style.  This is a replacement for
1390 the @code{rfc2231-encode-string} function.  @xref{rfc2231}.
1391
1392 When attaching files as @acronym{MIME} parts, we should use the RFC2231
1393 encoding to specify the file names containing non-@acronym{ASCII}
1394 characters.  However, many mail softwares don't support it in practice
1395 and recipients won't be able to extract files with correct names.
1396 Instead, the RFC2047-like encoding is acceptable generally.  This
1397 function provides the very RFC2047-like encoding, resigning to such a
1398 regrettable trend.  To use it, put the following line in your
1399 @file{~/.gnus.el} file:
1400
1401 @lisp
1402 (defalias 'mail-header-encode-parameter 'rfc2047-encode-parameter)
1403 @end lisp
1404
1405 @end table
1406
1407
1408 @node time-date
1409 @section time-date
1410
1411 While not really a part of the @acronym{MIME} library, it is convenient to
1412 document this library here.  It deals with parsing @code{Date} headers
1413 and manipulating time.  (Not by using tesseracts, though, I'm sorry to
1414 say.)
1415
1416 These functions convert between five formats: A date string, an Emacs
1417 time structure, a decoded time list, a second number, and a day number.
1418
1419 Here's a bunch of time/date/second/day examples:
1420
1421 @example
1422 (parse-time-string "Sat Sep 12 12:21:54 1998 +0200")
1423 @result{} (54 21 12 12 9 1998 6 nil 7200)
1424
1425 (date-to-time "Sat Sep 12 12:21:54 1998 +0200")
1426 @result{} (13818 19266)
1427
1428 (time-to-seconds '(13818 19266))
1429 @result{} 905595714.0
1430
1431 (seconds-to-time 905595714.0)
1432 @result{} (13818 19266 0)
1433
1434 (time-to-days '(13818 19266))
1435 @result{} 729644
1436
1437 (days-to-time 729644)
1438 @result{} (961933 65536)
1439
1440 (time-since '(13818 19266))
1441 @result{} (0 430)
1442
1443 (time-less-p '(13818 19266) '(13818 19145))
1444 @result{} nil
1445
1446 (subtract-time '(13818 19266) '(13818 19145))
1447 @result{} (0 121)
1448
1449 (days-between "Sat Sep 12 12:21:54 1998 +0200"
1450               "Sat Sep 07 12:21:54 1998 +0200")
1451 @result{} 5
1452
1453 (date-leap-year-p 2000)
1454 @result{} t
1455
1456 (time-to-day-in-year '(13818 19266))
1457 @result{} 255
1458
1459 (time-to-number-of-days
1460  (time-since
1461   (date-to-time "Mon, 01 Jan 2001 02:22:26 GMT")))
1462 @result{} 4.146122685185185
1463 @end example
1464
1465 And finally, we have @code{safe-date-to-time}, which does the same as
1466 @code{date-to-time}, but returns a zero time if the date is
1467 syntactically malformed.
1468
1469 The five data representations used are the following:
1470
1471 @table @var
1472 @item date
1473 An RFC822 (or similar) date string.  For instance: @code{"Sat Sep 12
1474 12:21:54 1998 +0200"}.
1475
1476 @item time
1477 An internal Emacs time.  For instance: @code{(13818 26466)}.
1478
1479 @item seconds
1480 A floating point representation of the internal Emacs time.  For
1481 instance: @code{905595714.0}.
1482
1483 @item days
1484 An integer number representing the number of days since 00000101.  For
1485 instance: @code{729644}.
1486
1487 @item decoded time
1488 A list of decoded time.  For instance: @code{(54 21 12 12 9 1998 6 t
1489 7200)}.
1490 @end table
1491
1492 All the examples above represent the same moment.
1493
1494 These are the functions available:
1495
1496 @table @code
1497 @item date-to-time
1498 Take a date and return a time.
1499
1500 @item time-to-seconds
1501 Take a time and return seconds.
1502
1503 @item seconds-to-time
1504 Take seconds and return a time.
1505
1506 @item time-to-days
1507 Take a time and return days.
1508
1509 @item days-to-time
1510 Take days and return a time.
1511
1512 @item date-to-day
1513 Take a date and return days.
1514
1515 @item time-to-number-of-days
1516 Take a time and return the number of days that represents.
1517
1518 @item safe-date-to-time
1519 Take a date and return a time.  If the date is not syntactically valid,
1520 return a ``zero'' date.
1521
1522 @item time-less-p
1523 Take two times and say whether the first time is less (i. e., earlier)
1524 than the second time.
1525
1526 @item time-since
1527 Take a time and return a time saying how long it was since that time.
1528
1529 @item subtract-time
1530 Take two times and subtract the second from the first.  I. e., return
1531 the time between the two times.
1532
1533 @item days-between
1534 Take two days and return the number of days between those two days.
1535
1536 @item date-leap-year-p
1537 Take a year number and say whether it's a leap year.
1538
1539 @item time-to-day-in-year
1540 Take a time and return the day number within the year that the time is
1541 in.
1542
1543 @end table
1544
1545
1546 @node qp
1547 @section qp
1548
1549 This library deals with decoding and encoding Quoted-Printable text.
1550
1551 Very briefly explained, qp encoding means translating all 8-bit
1552 characters (and lots of control characters) into things that look like
1553 @samp{=EF}; that is, an equal sign followed by the byte encoded as a hex
1554 string.
1555
1556 The following functions are defined by the library:
1557
1558 @table @code
1559 @item quoted-printable-decode-region
1560 @findex quoted-printable-decode-region
1561 QP-decode all the encoded text in the specified region.
1562
1563 @item quoted-printable-decode-string
1564 @findex quoted-printable-decode-string
1565 Decode the QP-encoded text in a string and return the results.
1566
1567 @item quoted-printable-encode-region
1568 @findex quoted-printable-encode-region
1569 QP-encode all the encodable characters in the specified region.  The third
1570 optional parameter @var{fold} specifies whether to fold long lines.
1571 (Long here means 72.)
1572
1573 @item quoted-printable-encode-string
1574 @findex quoted-printable-encode-string
1575 QP-encode all the encodable characters in a string and return the
1576 results.
1577
1578 @end table
1579
1580
1581 @node base64
1582 @section base64
1583 @cindex base64
1584
1585 Base64 is an encoding that encodes three bytes into four characters,
1586 thereby increasing the size by about 33%.  The alphabet used for
1587 encoding is very resistant to mangling during transit.
1588
1589 The following functions are defined by this library:
1590
1591 @table @code
1592 @item base64-encode-region
1593 @findex base64-encode-region
1594 base64 encode the selected region.  Return the length of the encoded
1595 text.  Optional third argument @var{no-line-break} means do not break
1596 long lines into shorter lines.
1597
1598 @item base64-encode-string
1599 @findex base64-encode-string
1600 base64 encode a string and return the result.
1601
1602 @item base64-decode-region
1603 @findex base64-decode-region
1604 base64 decode the selected region.  Return the length of the decoded
1605 text.  If the region can't be decoded, return @code{nil} and don't
1606 modify the buffer.
1607
1608 @item base64-decode-string
1609 @findex base64-decode-string
1610 base64 decode a string and return the result.  If the string can't be
1611 decoded, @code{nil} is returned.
1612
1613 @end table
1614
1615
1616 @node binhex
1617 @section binhex
1618 @cindex binhex
1619 @cindex Apple
1620 @cindex Macintosh
1621
1622 @code{binhex} is an encoding that originated in Macintosh environments.
1623 The following function is supplied to deal with these:
1624
1625 @table @code
1626 @item binhex-decode-region
1627 @findex binhex-decode-region
1628 Decode the encoded text in the region.  If given a third parameter, only
1629 decode the @code{binhex} header and return the filename.
1630
1631 @end table
1632
1633 @node uudecode
1634 @section uudecode
1635 @cindex uuencode
1636 @cindex uudecode
1637
1638 @code{uuencode} is probably still the most popular encoding of binaries
1639 used on Usenet, although @code{base64} rules the mail world.
1640
1641 The following function is supplied by this package:
1642
1643 @table @code
1644 @item uudecode-decode-region
1645 @findex uudecode-decode-region
1646 Decode the text in the region.
1647 @end table
1648
1649
1650 @node yenc
1651 @section yenc
1652 @cindex yenc
1653
1654 @code{yenc} is used for encoding binaries on Usenet.  The following
1655 function is supplied by this package:
1656
1657 @table @code
1658 @item yenc-decode-region
1659 @findex yenc-decode-region
1660 Decode the encoded text in the region.
1661
1662 @end table
1663
1664
1665 @node rfc1843
1666 @section rfc1843
1667 @cindex rfc1843
1668 @cindex HZ
1669 @cindex Chinese
1670
1671 RFC1843 deals with mixing Chinese and @acronym{ASCII} characters in messages.  In
1672 essence, RFC1843 switches between @acronym{ASCII} and Chinese by doing this:
1673
1674 @example
1675 This sentence is in @acronym{ASCII}.
1676 The next sentence is in GB.~@{<:Ky2;S@{#,NpJ)l6HK!#~@}Bye.
1677 @end example
1678
1679 Simple enough, and widely used in China.
1680
1681 The following functions are available to handle this encoding:
1682
1683 @table @code
1684 @item rfc1843-decode-region
1685 Decode HZ-encoded text in the region.
1686
1687 @item rfc1843-decode-string
1688 Decode a HZ-encoded string and return the result.
1689
1690 @end table
1691
1692
1693 @node mailcap
1694 @section mailcap
1695
1696 The @file{~/.mailcap} file is parsed by most @acronym{MIME}-aware message
1697 handlers and describes how elements are supposed to be displayed.
1698 Here's an example file:
1699
1700 @example
1701 image/*; gimp -8 %s
1702 audio/wav; wavplayer %s
1703 application/msword; catdoc %s ; copiousoutput ; nametemplate=%s.doc
1704 @end example
1705
1706 This says that all image files should be displayed with @code{gimp},
1707 that WAVE audio files should be played by @code{wavplayer}, and that
1708 MS-WORD files should be inlined by @code{catdoc}.
1709
1710 The @code{mailcap} library parses this file, and provides functions for
1711 matching types.
1712
1713 @table @code
1714 @item mailcap-mime-data
1715 @vindex mailcap-mime-data
1716 This variable is an alist of alists containing backup viewing rules.
1717
1718 @end table
1719
1720 Interface functions:
1721
1722 @table @code
1723 @item mailcap-parse-mailcaps
1724 @findex mailcap-parse-mailcaps
1725 Parse the @file{~/.mailcap} file.
1726
1727 @item mailcap-mime-info
1728 Takes a @acronym{MIME} type as its argument and returns the matching viewer.
1729
1730 @end table
1731
1732
1733
1734
1735 @node Standards
1736 @chapter Standards
1737
1738 The Emacs @acronym{MIME} library implements handling of various elements
1739 according to a (somewhat) large number of RFCs, drafts and standards
1740 documents.  This chapter lists the relevant ones.  They can all be
1741 fetched from @uref{http://quimby.gnus.org/notes/}.
1742
1743 @table @dfn
1744 @item RFC822
1745 @itemx STD11
1746 Standard for the Format of ARPA Internet Text Messages.
1747
1748 @item RFC1036
1749 Standard for Interchange of USENET Messages
1750
1751 @item RFC2045
1752 Format of Internet Message Bodies
1753
1754 @item RFC2046
1755 Media Types
1756
1757 @item RFC2047
1758 Message Header Extensions for Non-@acronym{ASCII} Text
1759
1760 @item RFC2048
1761 Registration Procedures
1762
1763 @item RFC2049
1764 Conformance Criteria and Examples
1765
1766 @item RFC2231
1767 @acronym{MIME} Parameter Value and Encoded Word Extensions: Character Sets,
1768 Languages, and Continuations
1769
1770 @item RFC1843
1771 HZ - A Data Format for Exchanging Files of Arbitrarily Mixed Chinese and
1772 @acronym{ASCII} characters
1773
1774 @item draft-ietf-drums-msg-fmt-05.txt
1775 Draft for the successor of RFC822
1776
1777 @item RFC2112
1778 The @acronym{MIME} Multipart/Related Content-type
1779
1780 @item RFC1892
1781 The Multipart/Report Content Type for the Reporting of Mail System
1782 Administrative Messages
1783
1784 @item RFC2183
1785 Communicating Presentation Information in Internet Messages: The
1786 Content-Disposition Header Field
1787
1788 @item RFC2646
1789 Documentation of the text/plain format parameter for flowed text.
1790
1791 @end table
1792
1793
1794 @node Index
1795 @chapter Index
1796 @printindex cp
1797
1798 @summarycontents
1799 @contents
1800 @bye
1801
1802 @c Local Variables:
1803 @c coding: iso-2022-7bit
1804 @c fill-column: 72
1805 @c mode: texinfo
1806 @c use-kuten-for-period: t
1807 @c use-touten-for-comma: t
1808 @c End: