📄 mailx.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>mailx</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_1346"> </a>NAME</h4><blockquote>mailx - process messages</blockquote><h4><a name = "tag_001_014_1347"> </a>SYNOPSIS</h4><blockquote><b>Send Mode:</b><p><pre><code>mailx <b>[</b>-s <i>subject</i><b>]</b><i> address</i>...</code></pre><p><b>Receive Mode:</b><p><pre><code>mailx -emailx <b>[</b>-HiNn<b>][</b>-F<b>][</b>-u <i>user</i><b>]</b>mailx -f<b>[</b>-HiNn<b>][</b>-F<b>][</b><i>file</i><b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_1348"> </a>DESCRIPTION</h4><blockquote>The<i>mailx</i>utility provides a message sending and receiving facility.It has two major modes, selected by the options used:Send Mode and Receive Mode.<h5><a name = "tag_001_014_1348_001"> </a>Send Mode</h5>Send Mode can be used by applications or usersto send messages from the text in standard input.<h5><a name = "tag_001_014_1348_002"> </a>Receive Mode</h5>Receive Mode is more oriented to interactive users.Mail can be read and sent in this interactive mode.<p>When reading mail,<i>mailx</i>provides commands to facilitate saving, deleting and responding tomessages.When sending mail,<i>mailx</i>allows editing, reviewing and other modification of the messageas it is entered.<p>Incoming mail is stored inone or more unspecified locations for each user,collectively called the system<i>mailbox</i>for that user.When<i>mailx</i>is invoked in Receive Mode,the system mailbox is the default place to find them.As messages are read,they will be marked to be moved to a secondary file for storage,unless specific action is taken.This secondary file is called the<b>mbox</b>and is normally located in the<i>HOME</i>directory of the user(see<i>MBOX</i>in the ENVIRONMENT VARIABLES section for a description of this file).Messages remain in this file until explicitly removed.When the<b>-f</b>option is used to read mail messages from secondary files,messages will be retained in those files unless specifically removed.All three of these locations system mailbox,<b>mbox</b>and secondary file are referredto in this section as simply "mailboxes",unless more specific identification is required.</blockquote><h4><a name = "tag_001_014_1349"> </a>OPTIONS</h4><blockquote>The<i>mailx</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b> </a> .<p>The following options are supported:<dl compact><dt><b>-e</b><dd>Test for the presence of mailin the system mailbox.The<i>mailx</i>utility will write nothingand exit with a successful return code if there ismail to read.<dt><b>-f</b><dd>Read messages from the file named by the<i>file</i>operand instead of the system mailbox.(See also<b>folder</b>.)If no<i>file</i>operand is specified,read messages from the<b>mbox</b>instead of the system mailbox.<dt><b>-F</b><dd>Record the message in a file named after the first recipient.The name is the login-name portion of the addressfound first on theTo:line in the mail header.Overrides the<b>record</b>variable, if set (see<xref href=mxintv><a href="#tag_001_014_1358_002">Internal Variables in mailx</a></xref>.)<dt><b>-H</b><dd>Write a header summary only.<dt><b>-i</b><dd>Ignore interrupts.(See also<b>ignore</b>).<dt><b>-n</b><dd>Do not initialise from the system defaultstart-up file.See the EXTENDED DESCRIPTION section.<dt><b>-N</b><dd>Do not write an initial header summary.<dt><b>-s </b><i>subject</i><dd>Set the Subject header field to<i>subject</i>.All characters in the<i>subject</i>string will appear in the delivered message.The results are unspecified if<i>subject</i>is longer than{LINE_MAX}- 10 bytes or contains anewline character.<dt><b>-u </b><i>user</i><dd>Read the system mailbox of the login name<i>user</i>.This will only besuccessful ifthe invoking user has the appropriateprivileges to read thesystem mailbox of that user.</dl></blockquote><h4><a name = "tag_001_014_1350"> </a>OPERANDS</h4><blockquote>The following operands are supported:<dl compact><dt><i>address</i><dd>Addressee of message.When<b>-n</b>is specified and no user start-up files are accessed (seethe EXTENDED DESCRIPTION section),this must be an address to pass to the mail delivery system.Any system or user start-up files may enable aliases (see<b>alias</b>under<xref href=mxcmds><a href="#tag_001_014_1358_003">Commands in mailx</a></xref>)that may modify the form of<i>address</i>before it is passed to the mail delivery system.<dt><i>file</i><dd>A pathname of a file to be read instead of the system mailbox when<b>-f</b>is specified.The meaning of the<i>file</i>option-argument is affected by the contents of the<b>folder</b>internal variable; see<xref href=mxintv><a href="#tag_001_014_1358_002">Internal Variables in mailx</a></xref>.</dl></blockquote><h4><a name = "tag_001_014_1351"> </a>STDIN</h4><blockquote>When<i>mailx</i>is invoked in Send Mode (the first synopsis line), standardinput must be the message to be delivered to the specified addresses.In both Send and Receive Modes,standard-input lines beginningwith the escape character (usually tilde(^))affect processing as described in<xref href=mxcmdesc><a href="#tag_001_014_1358_049">Command Escapes in mailx</a></xref>.</blockquote><h4><a name = "tag_001_014_1352"> </a>INPUT FILES</h4><blockquote>When<i>mailx</i>is used as described by this specification,the<i>file</i>option-argument (see the<b>-f</b>option) and the<b>mbox</b>must be text files containing mail messages,formatted as described in the OUTPUT FILES section.The nature of the system mailbox is unspecified;it need not be a file.</blockquote><h4><a name = "tag_001_014_1353"> </a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>mailx</i>:<dl compact><dt><i>DEAD</i><dd>Determine thepathname of the file in which to save partial messagesin case of interrupts or delivery errors.The default is<b>dead.letter</b>in the directory named by the<i>HOME</i>variable.<dt><i>EDITOR</i><dd>Determine thename of a utility to invoke when the<b>edit</b>(see<xref href=mxcmds><a href="#tag_001_014_1358_003">Commands in mailx</a></xref>)or~e(see<xref href=mxcmdesc><a href="#tag_001_014_1358_049">Command Escapes in mailx</a></xref>)command is used.The default editor is <i><a href="ed.html">ed</a></i>.<dt><i>HOME</i><dd>Determinethe pathname of the user's home directory.<dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments and input files)and the handling of case-insensitive address and header-field comparisons.<dt><i>LC_TIME</i><dd>Determine theformat and contents of the date and time strings written by<i>mailx</i>.<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard errorand informative messages written to standard output.<dt><i>LISTER</i><dd>Determine a stringrepresenting the command for writing thecontents of the<b>folder</b>directory to standard output when the<b>folders</b>command is given (see<b>folders</b>in<xref href=mxcmds><a href="#tag_001_014_1358_003">Commands in mailx</a></xref>).Any string acceptable as a<i>command_string</i>operand to the<i><a href="sh.html">sh</a></i><b>-c</b>command is valid.If this variable is null or not set,the output command will be<i><a href="ls.html">ls</a></i>.The default value is unset.<dt><i>MAILRC</i><dd>Determine the pathname of the start-up file.The default is<b>.mailrc</b>in the<i>HOME</i>directory.<dt><i>MBOX</i><dd>Determinea pathname of the file to save messagesfrom the system mailbox that have been read.The<b>exit</b>command overrides this function,as will saving the message explicitly in another file.The default isin the directory named by the<i>HOME</i>variable.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i><dt><i>PAGER</i><dd>Determine a stringrepresenting an output filtering or pagination command for writingthe output to the terminal.Any string acceptable as a<i>command_string</i>operand to the<i><a href="sh.html">sh</a></i><b>-c</b>command is valid.When standard output is a terminal device,the message output will be pipedthrough the command if the<i>mailx</i>internal variable<b>crt</b>is set to a value less the numberof lines in the message;see<xref href=mxintv><a href="#tag_001_014_1358_002">Internal Variables in mailx</a></xref>.If the<i>PAGER</i>variable is null or not set,the paginator will beeither<i><a href="more.html">more</a></i>or another paginator utility documented in the system documentation.<dt><i>SHELL</i><dd>Determine the name of a preferred command interpreter.The default is<i><a href="sh.html">sh</a></i>.<dt><i>TERM</i><dd>Determine the name of the terminal type,to indicate in an unspecified manner,if the internal variable<b>screen</b>is not specified,the number of lines in a screenful of headers.If<i>TERM</i>is not set or is set to null,an unspecified defaultterminal type will be used and the value ofa screenful is unspecified.<dt><i>VISUAL</i><dd>Determine apathname of a utility to invoke when the<b>visual</b>command (see<xref href=mxcmds><a href="#tag_001_014_1358_003">Commands in mailx</a></xref>)or~vcommand-escape (see<xref href=mxcmdesc><a href="#tag_001_014_1358_049">Command Escapes in mailx</a></xref>)is used.If this variable is null or not set,the full-screen editor will be<i><a href="vi.html">vi</a></i>.</dl></blockquote><h4><a name = "tag_001_014_1354"> </a>ASYNCHRONOUS EVENTS</h4><blockquote>When<i>mailx</i>is in Send Mode and standard input is not a terminal,it takes the standard action for all signals.<p>In Receive Mode, or in Send Mode whenstandard input is a terminal, if a SIGINT signal is received:<ol><p><li>If in command mode, the current command, if there is one, will beaborted, and a command-modeprompt will be written.<p><li>If in input mode:<ol type = a><p><li>If<b>ignore</b>is set,<i>mailx</i>will write@\n,discard the current input line, and continue processing,bypassing the message-abort mechanism described in item 2b.<p><li>If the interrupt was received while sending mail, eitherwhen in Receive Mode or in Send Mode, a message will be written,and another subsequent interrupt,with no other intervening characters typed,will be required to abort the mail message.If in Receive Mode and anotherinterrupt is received, a command-mode prompt will be written.If in Send Mode and another interrupt is received,<i>mailx</i>will terminate with a non-zero status.<p>In both cases listed in item b, if the message is not empty:<ol type = i><p><li>If<b>save</b>is enabled and the file named by<i>DEAD</i>can be created, the message will be written to the file named by<i>DEAD .</i>If the file exists, the message will be written toreplace the contents of the file.<p><li>If<b>save</b>is not enabled, or the file named by<i>DEAD</i>cannot be created, the message will not be saved.<p></ol><p></ol><p></ol><p>The<i>mailx</i>utility takes the standard action for all other signals.</blockquote><h4><a name = "tag_001_014_1355"> </a>STDOUT</h4><blockquote>In command and input modes, all output, including prompts andmessages, is written to standard output.</blockquote><h4><a name = "tag_001_014_1356"> </a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_1357"> </a>OUTPUT FILES</h4><blockquote>Various<i>mailx</i>commands and command escapes can create or add to files,including the<b>mbox</b>,the dead-letter fileand secondary mailboxes.When<i>mailx</i>is used as described in this specification,these files will be text files, formatted as follows:<p><dl compact><dt> <dd><i>line beginning with </i>From<space><br><b>[</b>one or more <i>header-lines</i>; see <xref href=mxcmds><a href="#tag_001_014_1358_003"> Commands in mailx </a></xref><b>]<br></b><i>empty line<br></i><b>[</b>zero or more <i>body lines<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -