📄 6m52wfbx4n9x3cs.html
字号:
<HTML><HEAD> <TITLE>Mailcap File Definition</TITLE></HEAD><BODY bgcolor="#ffffff"><H1><A NAME="6m52wFBX4N9X3cS">Mailcap File Definition</H1><P>A MIME message contains message blocks of a variety offile-types that can be displayed or created using a number oftools. You or your organization may prefer one tool over another.You can also define your own file-types in<CITE>Ishmail</CITE>. To handle suchflexibility,<CITE>Ishmail</CITE> provides mechanisms for defining uniquefile-types and display methods through the use of the mailcapfiles.<P>The purpose of the mailcap is to indicate to<CITE>Ishmail</CITE> what programto run in order to show user mail in a given format. With<CITE>Ishmail</CITE>,it is possible to add a new file-type to all of the mail readingprograms at a site simply by adding a line to a the system<SAMP>mailcap</SAMP> file. This can be overridden by defining the<CODE>$SYSMAILCAP</CODE>environment variable.<P><CITE>Ishmail</CITE> also attempts to read a user-provided<I>mailcap</I> file in theuser's home directory. This file is<I>$HOME/.mailcap</I>. This file doesnot have to exist. But, if it does, its entries will take precedenceover entries of the same type in the system mailcap file.<P>The syntax of amailcap file is fairly simple and straightforward.Any line that starts with<SAMP>#</SAMP> is a comment. Blank lines are ignored.Otherwise, each line defines a single mailcap entry for a singlecontent type. Long lines may be continued by ending them witha backslash character, "<SAMP>\</SAMP>".<P>Each individualmailcap entry consists of a content-typespecification, a command to execute, and (possibly) a set ofoptional flag values. For example, a very simple mailcap entrymight look like this:<PRE>image/gif; xloadimage %s</PRE><P>The optional flags can be used to specify additional informationabout the mail-handling command. For example:<PRE>image/gif; xloadimage %s; label="A GIF Image"</PRE><P>can be added to use as a default label to display when a MIMEmessage arrives with an image/gif type, that provides nodescription of itself.<P>The type field (image/gif, in the above example) is simply anylegal content type name, as defined by<CITE>Internet RFC 1341(Multipurpose Internet Mail Extension)</CITE>. In practice, this isalmost any string. It is the string that will be matched againstthe "Content-type" header to decide if this is the mailcap entrythat matches the current message.<P>Additionally, the type field may specify a subtype or a wildcardto match all subtypes (for example, "image/*"). A wild carddefinition should follow specific definitions, because<CITE>Ishmail</CITE> willattempt to match the first entry it finds.<P>The command field is any UNIX command ("xloadimage %s" inthe above example), and is used to specify the interpreter for thegiven type of message. Semicolons and backslashes within thecommand must be quoted with backslashes. If the commandcontains "%s", those two characters will be replaced by the nameof a file that contains the body of the message. If it contains "%t",those two characters will be replaced by the content-type field,including the subtype, if any. (That is, if the content-type was"image/jpeg; opt1=something-else", then "%t" would be replacedby "image/jpeg".)<P>If the command field contains "%{" followed by a parameter nameand a closing "}", then all those characters will be replaced by thevalue of the value of the named parameter, if any, from the valueof the Content-type header. Thus, in the earlier example,"%{opt1}" will be replaced by "something-else". If a parameter isspecified for the command, and the body part does not have avalue for it, then "" (two double quotes representing the emptystring) is substituted on the command line.<P>If the command contains a "%e", those two characters will bereplaced by the value of the Content-Transfer-Encoding, if thereis one. This is useful particularly for external-body types, and thecommand needs to decode the retrieved body.<P>There are two additional built-in parameters; %{ruser} and%{rpwd}. The first,<CODE>ruser</CODE>, is where a user-supplied user accountname is substituted on the command line. This is commonly usedfor external-body types that use "ftp" as an access-type. The<CODE>rpwd</CODE>parameter is for the accompanying password.<P>If no "%s" appears in the command field, then instead of placingthe message body in a temporary file,<CITE>Ishmail</CITE> passes the body tothe command on the standard input.<P>The "notes=xxx" field is an uninterpreted string that is used tospecify the name of the person who installed this entry in themailcap file. (The "xxx" may be replaced by any text string.)<P>The "test=xxx" field is a command that is executed to determinewhether the mailcap line actually applies. That is, if thecontent-type field matches the content-type on the message, buta "test=" field is present, then the test must succeed before themailcap line is considered to "match" the message being viewed.The command may be any UNIX command, using the samesyntax and the same %-escapes as for the viewing command, asdescribed above. A command is considered to succeed if it exitswith a zero exit status, and to fail otherwise.<P>The "print=xxx" field is a command to use when you want to printthe file. For instance application/postscript type could have anentry:<PRE>application/postscript; ghostview %s; print=lpr -P ps_printer</PRE><P>The "textualnewlines" field can be used in the rather obscurecase where<CITE>Ishmail's</CITE> default rules for treating newlines inbase64-encoded data are unsatisfactory. By default,<CITE>Ishmail</CITE>translates<B>CRLF</B> to the local newline character in decodedbase64 output if the content-type is "text" (any subtype), but willnot do so otherwise. A mailcap entry with a field of"textualnewlines=1" will force such translation for the specifiedcontent-type, while "textualnewlines=0" will guarantee that thetranslation does not take place even for textual content-types.<P><CITE>Ishmail</CITE> handles the following types automatically, thus negatinga need for mailcap entries for text/plain, text/richtext, multipart/mixed, multipart/digest, multipart/alternative,multipart/parallel, message/rfc822, and message/partial. Butthis does not preclude creating<I>mailcap</I> entries for these types if,for some reason, you'd rather not use the built-in presentationmechanisms for these types.<P><CITE>Ishmail</CITE> has a default entry for message/external-body in themailcap shipped with the program. It is recommended that thisentry not be changed.<P><CITE>Ishmail</CITE> also has default entries for image/gif and audio/basic.However, if you have a better application for presenting thesetypes, make the change there.<HR>Preceding Section: <A HREF="Xj52wFBX4N9X3cS.html">Ishmail Resources</A><BR>Following Section: <A HREF="3InsZOBOAH9X3cS.html">Sample Mailcap File</A><BR>Parent Section: <A HREF="Xj52wFBX4N9X3cS.html">Ishmail Resources</A><BR>Contents of <A HREF="zsPsIGBSYWwA0YK.html">Ishmail User's Guide</A><BR><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -