⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slocal.1mh

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 1MH
字号:
.TH slocal 1mh.SH Nameslocal \- MH receive-mail hooks.SH Syntax.B slocal.B $HOME/\&.maildelivery[.B \-form.I formfile] [.I "switches for".PN postproc].I "address ..."[.B \-help].PP.B /usr/lib/mh/rcvpack.I file[.B \-help].PP.B /usr/lib/mh/rcvtty [.I "command ..."] [.B \-help].\".\".\".\".SH Description.NXR "slocal command"A receive-mail hook is a program that is run whenever you receive amail message.You do not invoke the hook yourself;  it is invoked on your behalf by .PN sendmail ,when you include the following linein your .PN \&.forward file in your home directory:.EX| /usr/lib/mh/slocal \-user $USER.EE.PPThe .PN \&.maildelivery file,which is an ordinary ASCII file,controls how local delivery is performed.This file is read by .PN slocal ..PPThe format of each line in the .PN \&.maildeliveryfile is:.EXfield pattern action result string.EE.PPThese components are explained below:.\".IP "field:" 10The name of a field that is to be searched for a pattern.This is any field in the headers of the message that might be present.In addition, the following special fields are also defined:.IP .IR source : the out-of-band sender information.IP.IR addr : the address that was used to cause delivery to the recipient.IP.IR default : this matches only if the message has not been delivered yet.IP.IR * :this always matches.\".\".IP "pattern:"The sequence of characters to match in the specified field.Matching is case-insensitive but not Regular Expression-based..\".\".IP "action:" 10The action to take to deliver the message.This is one of the following:.\".IP " " 10.I fileor.IR > :.IP Append the message to the file named by .B string using the standard maildrop delivery process.If the message can be appended to the file,then this action succeeds.When writing to the file,a new field is added:.EXDelivery-Date: <date>.EEThis field indicates the date and time at which the message was appended to the file..\".IP " " 10.I pipeor | :.IP Pipe the message as the standard input to the command named by .BR string .The Bourne shell,.MS sh 1 ,is used to interpret the string.Prior to giving the string to the shell,it is expanded with the following built-in variables:.IP\f(CW$(sender)\fR: the return address for the message.IP\f(CW$(address)\fR: the address that was used to cause delivery to the recipient.IP\f(CW$(size)\fR: the size of the message in bytes.IP\f(CW$(reply-to)\fR: either the \f(CWReply-To:\fR or \f(CWFrom:\fR field of the message.IP\f(CW$(info)\fR: miscellaneous out-of-band information.IPWhen a process is invoked, its environment is as follows:the user/group id's are set to recipient's id's;the working directory is the recipient's directory;the umask is 0077;the process has no .PN /dev/tty ;the standard input is set to the message;the standard output and diagnostic output are set to .PN /dev/null ;all other file-descriptors are closed;the environment variables \f(CW$USER\fR, \f(CW$HOME\fR, and \f(CW$SHELL\fR are set appropriately;no other environment variables exist..IPThe process is given a certain amount of time to execute.If the process does not exit within this limit,it is terminated.The amount of time is calculated as \f(CW((size x 60) + 300)\fR seconds,where size is the number of bytes in the message..IPThe exit status of the process is consulted to determine the success of the action.An exit status of 0 means that the action succeeded.Any other exit status (or abnormal termination) means that the action failed..IPIn order to avoid any time limitations,you might implement a process that began by forking.The parent would return the appropriate value immediately,and the child could continue to do whatever it wantedfor as long as it wanted.This approach should only be used if you do not care about the outcome of the action, because the success or failure of the child process cannot be passedback to.PN slocal .However, if the parent is going to return a non-zero exit status,then this approach can lead to quicker delivery into your maildrop..\".IP " " 10.I qpipeor.I "^" :.IP This is similar to .IR pipe ,but executes the command directly,after built-in variable expansion,without assistance from the shell..\".IP " " 10.IR destroy :.IP This action always succeeds..IP "result:" 10Indicates how the action should be performed.The following values are valid:.IP " " 10.IR A :.IPPerform the action.If the action succeeded, then the message is considered delivered..IP " " 10.IR R :.IPPerform the action.Regardless of the outcome of the action,the message is not considered delivered..IP " " 10.IR "?" :.IP Perform the action only if the message has not been delivered.If the action succeeded, then the message is considered delivered..\".\".PPThe file is always read completely,so that several matches can be made and several actions can be taken.The .PN \&.maildeliveryfile must be owned either by the user or by root,and must be writable only by the owner.If the .PN \&.maildeliveryfile cannot be found, or does not perform an action which delivers the message, then the file .PN /usr/lib/mh/maildelivery is read according to the same rules.This file must be owned by the root and must be writable only by the root.If this file cannot be found or does not perform an action which delivers the message,then standard delivery to the user's maildrop, .PN /usr/spool/mail/$USER , is performed..PPArguments in the .PN \&.maildeliveryfile are separated by a comma (,) or by white space.Since double quotes are honored,these characters may be included in a single argument by enclosing the entire argument in double quotes (").A double quote can be included by preceding it with a back-slash..\".\".PPFour programs are currently available:.PN rcvdistredistributes incoming messages to additional recipients;.PN rcvpack saves incoming messages in a .MS packf 1mhfile; and.PN rcvttynotifies the user of incoming messages.The fourth program,.PN rcvstore ,is described in the.MS rcvstore 1mhreference page.They all reside in the .PN /usr/lib/mhdirectory..PPThe .PN rcvdistprogram resends a copy of the message to all of theaddresses listed on its command line.It uses the format string facility described in .MS mh-format 5mh ..PPThe .PN rcvpackprogram appends a copy of the message to the file listedon its command line.It is made obsolete by.PN \&.maildelivery ..PPThe .PN rcvttyprogram executes the named file with the message as its standard input,and gives the resulting output to the terminal access daemon for display on your terminal.If the terminal access daemon is unavailable on your system, then .PN rcvttywrites the output to your terminal,only if your terminal has world-writable permission.If no valid file is specified, then.PN rcvtty gives a one-line scan listingto the terminal access daemon..\".\".\".\".SH RestrictionsFor compatibility with older versions of MH, if .PN slocal cannot find the user's .PN \&.maildeliveryfile,it attempts to execute an old-style .PN rcvmail hook in the user's .PN $HOMEdirectory.Specifically,it first attempts to execute the command:.EX \&.mh_receive file maildrop directory user.EEFailing that it attempts to execute:.EX$HOME/bin/rcvmail user file sender.EEIf both of these fail, it gives upand write to the user's maildrop..PPIn addition,whenever a hook or process is invoked,file-descriptor three (3) is set to the message in addition to the standard input..PPOnly two return codes are meaningful, others should be..\".\".\".\".SH ExamplesThis section shows how.PN slocal could be used..PPIn this example, line-by-line comments have been extracted from the codeto aid readability of the example.  The line numbers would not normally be in the code; they are there to help you.  The code fragment precedes theexplanation:.PP.TStab(@);l l l l l l.@\fIfield@pattern@action@result@string\fR.sp 6p(1)@To@mmdf2@file@A@mmdf2.log(2)@From@mmdf@pipe@A@err-message-archive(3)@Sender@uk-mmdf@file@?@mmdf2.log(4)@To@Unix@>@A@unix-news(5)@addr@jpo=mmdf@|@A@mmdf-redist(6)@addr@jpo=ack@|@R@resend \-r $(reply-to)(7)@From@steve@destroy@A@\-(8)@default@\-@>@?@mailbox(9)@*@\-@|@R@rcvalert.TE.TP 10Line 1:File mail with \f(CWmmdf2\fR in the \f(CWTo:\fR line into file .PN mmdf2.log ..TP 10Line 2:Messages from \f(CWmmdf\fR are piped to the program .PN err-message-archive ..TP 10Line 3: Take anything with the address \f(CWuk-mmdf\fRin the \f(CWSender:\fR field, and file it in .PN mmdf2.log ,if it has not already been filed by line 1..TP 10Line 4:Put messages addressed to \f(CWUnix\fR in the file.PN unix-news ..TP 10Line 5:If the address is \f(CWjpo=mmdf\fR,pipe the message into .PN mmdf-redist ..TP 10Line 6:If the address is \f(CWjpo=ack\fR,send an acknowledgement copy back..TP 10Line 7:Destroy anything from \f(CWsteve\fR..TP 10Line 8:Take anything that is not matched yetand put it into mailbox..TP 10Line 9:Always run .PN rcvalert ..\".\".\".\".SH Files.TP 10.PN /usr/lib/mh/mtstailorThe system customization file..TP 10.PN /usr/lib/mh/maildeliveryThe system default file controlling local delivery..TP 10.PN $HOME/.maildeliveryThe user-supplied alternative to the system default filecontrolling local delivery..\".\".\".\".SH See Alsorcvstore(1mh)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -