📄 slocal.man
字号:
SLOCAL(1) BSD Reference Manual SLOCAL(1)NNAAMMEE slocal - special local mail deliverySSYYNNOOPPSSIISS /usr/contrib/mh-6.8/lib/slocal [address info sender] [-addr address] [-info data] [-sender sender] [-user username] [-mailbox mbox] [-file file] [-maildelivery deliveryfile] [-verbose] [-noverbose] [-debug] [-help]DDEESSCCRRIIPPTTIIOONN _S_l_o_c_a_l is a program designed to allow you to have your inbound mail processed according to a complex set of selection criteria. You do not normally invoke _s_l_o_c_a_l yourself, rather _s_l_o_c_a_l is invoked on your behalf by your system's Message Transfer Agent. The message selection criteria used by _s_l_o_c_a_l is specified in the file _._m_a_i_l_d_e_l_i_v_e_r_y in the user's home directory. The format of this file is given below. The message delivery address and message sender are deter- mined from the Message Transfer Agent envelope informa- tion, if possible. Under _S_e_n_d_M_a_i_l, the sender will obtained from the UUCP "From " line, if present. The user may override these values with command line arguments, or arguments to the `-addr' and `-sender' switches. The message is normally read from the standard input. The `-file' switch sets the name of the file from which the message should be read, instead of reading stdin. The `-user' switch tells _s_l_o_c_a_l the name of the user for whom it is delivering mail. The `-mailbox' switch tells _s_l_o_c_a_l the name of the user's maildrop file. The `-info' switch may be used to pass an arbitrary argu- ment to sub-processes which _s_l_o_c_a_l may invoke on your behalf. The `-verbose' switch causes _s_l_o_c_a_l to give information on stdout about its progress. The `-debug' switch produces more verbose debugging output on stderr. MMeessssaaggee TTrraannssffeerr AAggeennttss If your MTA is _S_e_n_d_M_a_i_l, you should include the line "| /usr/contrib/mh-6.8/lib/slocal -user username" in your .forward file in your home directory. This will cause _S_e_n_d_M_a_i_l to invoke _s_l_o_c_a_l on your behalf. If your MTA is _M_M_D_F_-_I, you should (symbolically) link[mh.6] MH.6.8 1SLOCAL(1) BSD Reference Manual SLOCAL(1) /usr/contrib/mh-6.8/lib/slocal to the file bin/rcvmail in your home directory. This will cause _M_M_D_F_-_I to invoke _s_l_o_c_a_l on your behalf with the correct "_a_d_d_r_e_s_s _i_n_f_o _s_e_n_d_e_r" arguments. If your MTA is _M_M_D_F_-_I_I, then you should not use _s_l_o_c_a_l. An equivalent functionality is already provided by _M_M_D_F_- _I_I; see maildelivery(5) for details. TThhee MMaaiillddeelliivveerryy FFiillee The _._m_a_i_l_d_e_l_i_v_e_r_y file controls how local delivery is per- formed. Each line of this file consists of five fields, separated by white-space or comma. 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 backslash. Lines beginning with `#' are ignored. The format of each line in the _._m_a_i_l_d_e_l_i_v_e_r_y file is: hheeaaddeerr ppaatttteerrnn aaccttiioonn rreessuulltt ssttrriinngg hheeaaddeerr: The name of a header field that is to be searched for a pattern. This is any field in the headers of the message that might be present. The following special fields are also defined: _s_o_u_r_c_e the out-of-band sender information _a_d_d_r the address that was used to cause delivery to the recipient _d_e_f_a_u_l_t this matches _o_n_l_y if the message hasn't been delivered yet _* this always matches ppaatttteerrnn: The sequence of characters to match in the specified header field. Matching is case-insensitive, but does not use regular expressions. aaccttiioonn: The action to take to deliver the message: _d_e_s_t_r_o_y This action always succeeds. _f_i_l_e or > Append the message to the file named by ssttrriinngg. The message is appended to the file in the maildrop format which is used by your message transport system. If the message can be appended to the file, then[mh.6] MH.6.8 2SLOCAL(1) BSD Reference Manual SLOCAL(1) this action succeeds. When writing to the file, a "Delivery-Date: date" header is added which indicates the date and time that message was appended to the file. _m_b_o_x Identical to _f_i_l_e, but always appends the message using the format used by _p_a_c_k_f (the MMDF mailbox format). _p_i_p_e or | Pipe the message as the standard input to the command named by ssttrriinngg, using the Bourne shell _s_h(1) to interpret the string. Prior to giving the string to the shell, it is expanded with the following built-in variables: $(sender) the out-of-band sender informa- tion $(address) the address that was used to cause delivery to the recipient $(size) the size of the message in bytes $(reply-to) either the "Reply-To:" or "From:" field of the message $(info) the out-of-band information spec- ified _q_p_i_p_e or _<_c_a_r_e_t_> Similar to _p_i_p_e, but executes the command directly, after built-in variable expan- sion, without assistance from the shell. This action can be used to avoid quoting special characters which your shell might interpret. rreessuulltt: Indicates how the action should be performed: _A Perform the action. If the action suc- ceeds, then the message is considered delivered. _R Perform the action. Regardless of the out- come of the action, the message is not con- sidered delivered. _? Perform the action only if the message has not been delivered. If the action suc- ceeds, then the message is considered delivered. _N Perform the action only if the message has not been delivered and the previous action[mh.6] MH.6.8 3SLOCAL(1) BSD Reference Manual SLOCAL(1) succeeded. If this action succeeds, then the message is considered delivered. To summarize, here's an example: #_f_i_e_l_d _p_a_t_t_e_r_n _a_c_t_i_o_n _r_e_s_u_l_t _s_t_r_i_n_g # lines starting with a '#' are ignored, as are blank lines # # file mail with mmdf2 in the "To:" line into file mmdf2.log _T_o _m_m_d_f_2 _f_i_l_e _A _m_m_d_f_2_._l_o_g # Messages from mmdf pipe to the program err-message-archive _F_r_o_m _m_m_d_f _p_i_p_e _A _/_b_i_n_/_e_r_r_-_m_e_s_s_a_g_e_-_a_r_c_h_i_v_e # Anything with the "Sender:" address "mh-workers" # file in mh.log if not filed already _S_e_n_d_e_r _m_h_-_w_o_r_k_e_r_s _f_i_l_e _? _m_h_._l_o_g # "To:" unix - put in file unix-news _T_o _U_n_i_x _> _A _u_n_i_x_-_n_e_w_s # if the address is jpo=ack - send an acknowledgement copy back _a_d_d_r _j_p_o_=_a_c_k | _R _"_/_b_i_n_/_r_e_s_e_n_d _-_r _$_(_r_e_p_l_y_-_t_o_)_" # anything from steve - destroy! _F_r_o_m _s_t_e_v_e _d_e_s_t_r_o_y _A _- # anything not matched yet - put into mailbox _d_e_f_a_u_l_t _- _> _? _m_a_i_l_b_o_x # always run rcvtty _* _- | _R _/_m_h_/_l_i_b_/_r_c_v_t_t_y The file is always read completely, so that several matches can be made and several actions can be taken. The _._m_a_i_l_d_e_l_i_v_e_r_y file must be owned either by the user or by root, and must be writable only by the owner. If the _._m_a_i_l_d_e_l_i_v_e_r_y file cannot be found, or does not perform an action which delivers the message, then the file /usr/contrib/mh-6.8/lib/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 is performed. SSuubb--pprroocceessss eennvviirroonnmmeenntt When a process is invoked, its environment is: the user/group-ids are set to recipient's ids; the working directory is the recipient's home directory; the umask is 0077; the process has no /dev/tty; the standard input is set to the message; the standard output and diagnostic output are set to /dev/null; all other file-descriptors are closed; the envariables $$UUSSEERR, $$HHOOMMEE, $$SSHHEELLLL are set appropriately, and no other envariables exist. The process is given a certain amount of time to execute.[mh.6] MH.6.8 4SLOCAL(1) BSD Reference Manual SLOCAL(1) If the process does not exit within this limit, the pro- cess will be terminated with extreme prejudice. The amount of time is calculated as ((size x 60) + 300) sec- onds, where size is the number of bytes in the message. The exit status of the process is consulted in determining the success of the action. An exit status of zero means that the action succeeded. Any other exit status (or abnormal termination) means that the action failed. In order to avoid any time limitations, you might imple- ment a process that began by _f_o_r_k_i_n_g. The parent would return the appropriate value immediately, and the child could continue on, doing whatever it wanted for as long as it wanted. This approach is somewhat risky if the parent is going to return an exit status of zero. If the parent is going to return a non-zero exit status, then this approach can lead to quicker delivery into your maildrop.FFIILLEESS /usr/contrib/mh-6.8/lib/mtstailor MH tailor file $HOME/.maildelivery The file controlling local delivery /usr/contrib/mh-6.8/lib/maildelivery Rather than the standard file /var/mail/$USER The default maildropSSEEEE AALLSSOO rcvstore(1), mhook(1), mh-format(5)DDEEFFAAUULLTTSS `-noverbose' `-maildelivery .maildelivery' `-mailbox /var/mail/$USER' `-file' defaults to stdin `-user' defaults to the current userCCOONNTTEEXXTT NoneHHIISSTTOORRYY _S_l_o_c_a_l is designed to be backward-compatible with the _m_a_i_l_d_e_l_i_v_e_r_y facility provided by _M_M_D_F_-_I_I. Thus, the _._m_a_i_l_d_e_l_i_v_e_r_y file syntax is limited, as is the function- ality of _s_l_o_c_a_l. In addition to an exit status of zero, the _M_M_D_F values _R_P___M_O_K (32) and _R_P___O_K (9) mean that the message has been fully delivered. Any other non-zero exit status, includ- ing abnormal termination, is interpreted as the _M_M_D_F value _R_P___M_E_C_H (200), which means "use an alternate route" (deliver the message to the maildrop).[mh.6] MH.6.8 5SLOCAL(1) BSD Reference Manual SLOCAL(1)BBUUGGSS Only two return codes are meaningful, others should be. _S_l_o_c_a_l is designed to be backwards-compatible with the _m_a_i_l_d_e_l_i_v_e_r_y functionality provided by MMMMDDFF--IIII. Versions of _M_M_D_F with the _m_a_i_l_d_e_l_i_v_e_r_y mechanism aren't entirely backwards-compatible with earlier versions of _M_M_D_F. If you have an _M_M_D_F_-_I old-style hook, the best you can do is to have a one-line _._m_a_i_l_d_e_l_i_v_e_r_y file: default - pipe A "bin/rcvmail $(address) $(info) $(sender)"[mh.6] MH.6.8 6
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -