8 date 95.12.06.23.31.56; author jromine; state Exp;
13 date 92.10.29.22.03.44; author jromine; state Exp;
18 date 92.10.28.16.53.03; author jromine; state Exp;
23 date 92.05.12.22.23.34; author jromine; state Exp;
28 date 92.02.15.00.10.42; author jromine; state Exp;
33 date 92.02.12.19.08.15; author jromine; state Exp;
38 date 92.02.10.20.00.15; author jromine; state Exp;
43 date 92.02.03.18.11.52; author jromine; state Exp;
48 date 90.04.05.22.18.43; author sources; state Exp;
53 date 90.04.05.22.12.11; author sources; state Exp;
58 date 90.04.05.15.13.25; author sources; state Exp;
63 date 90.03.22.11.31.26; author sources; state Exp;
68 date 90.03.21.16.28.55; author sources; state Exp;
73 date 90.03.20.19.42.05; author sources; state Exp;
78 date 90.03.20.17.36.21; author sources; state Exp;
83 date 90.03.20.17.21.04; author sources; state Exp;
94 @document %{addresses} for rcvdist
98 .\" @@(#)$Id: mhook.rf,v 1.15 1992/10/29 22:03:44 jromine Exp jromine $
101 mhook, rcvdist, rcvpack, rcvtty \- MH receive-mail hooks
105 @@(MHETCPATH)/rcvdist
107 \%[switches\ for\ \fIpostproc\fR]
112 @@(MHETCPATH)/rcvpack
119 \%[\-form\ formatfile]
121 \%[\-bell] \%[\-nobell]
122 \%[\-newline] \%[\-nonewline]
127 A receive\-mail hook is a program that is run whenever you receive a
129 You do \fBNOT\fR invoke the hook yourself,
130 rather the hook is invoked on your behalf by your
131 system's Message Transport Agent. See \fIslocal\fP\0(1)
132 for details on how to activate receive\-mail hooks on your system.
134 Four programs are currently available as part of \fIMH\fP,
135 \fIrcvdist\fR (redistribute incoming messages to additional recipients),
136 \fIrcvpack\fR (save incoming messages in a \fIpackf\fR'd file),
137 and \fIrcvtty\fR (notify user of incoming messages).
139 \fIrcvstore\fR\0(1) is described separately.
140 They all reside in the \fI@@(MHETCPATH)/\fR directory.
142 The \fIrcvdist\fR program will resend a copy of the message to all of the
143 addresses listed on its command line.
144 It uses the format string facility described in \fImh\-format\fR\0(5).
145 In addition, \fIrcvdist\fP
146 also recognizes the following additional \fIcomponent\fR escape:
150 .ta \w'Dtimenow 'u +\w'Returns 'u
151 \fIEscape\fR \fIReturns\fR \fIDescription\fR
152 addresses string the addresses to distribute to
156 The \fIrcvpack\fR program will append a copy of the message to the file listed
158 Its use is obsoleted by the \*(lqfile\*(rq action of \fIslocal\fR.
160 The \fIrcvtty\fR program executes the named file with the message as its
162 and writes the resulting output
165 If no file is specified, or is bogus, etc.,
166 then \fIrcvtty\fR will instead write a one\-line scan listing.
167 Either the `\-form\ formatfile' or `\-format\ string' option may be used
168 to override the default output format (see \fImh\-format\fP\0(5)).
169 A newline is output before the
170 message output, and the terminal bell is rung
171 after the output. The `\-nonewline' and `\-nobell' options
172 will inhibit these functions.
174 In addition to the standard \fImh\-format\fR\0(5) escapes,
175 \fIrcvtty\fR also recognizes the following additional \fIcomponent\fR escapes:
179 .ta \w'Dtimenow 'u +\w'Returns 'u
180 \fIEscape\fR \fIReturns\fR \fIDescription\fR
181 body string the (compressed) first part of the body
182 dtimenow date the current date
183 folder string the name of the current folder
187 Normally, \fIrcvtty\fP obeys
188 write permission as granted by \fImesg\fP\0(1).
189 With the `\-biff' option, \fIrcvtty\fP will obey the notification
190 status set by \fIbiff\fP\0(1) instead.
191 If the terminal access daemon (TTYD) is available on your system,
192 then \fIrcvtty\fR will give its output to the daemon for output
193 instead of writing on the user's terminal.
195 ^@@(MHETCPATH)/mtstailor~^tailor file
196 ^$HOME/\&.maildelivery~^The file controlling local delivery
197 ^@@(MHETCPATH)/maildelivery~^Rather than the standard file
199 rcvstore (1), mh\-format(5), slocal(1)
201 Only two return codes are meaningful, others should be.
208 @document additional rcvtty escapes
213 .\" @@(#)$Id: mhook.rf,v 1.14 1992/10/28 16:53:03 jromine Exp jromine $
225 .\" @@(#)$Id: mhook.rf,v 1.13 1992/05/12 22:23:34 jromine Exp jromine $
232 @fixup for nroff problems
237 .\" @@(#)$Id: mhook.rf,v 1.12 1992/02/15 00:10:42 jromine Exp jromine $
240 system's Message Transport Agent. See \fIslocal\fP\0(8)
243 rcvstore (1), mh\-format(5), slocal (8)
254 .\" @@(#)$Id: mhook.rf,v 1.11 1992/02/12 19:08:15 jromine Exp jromine $
257 mhook, rcvdist, rcvpack, rcvtty \- MH receive\-mail hooks
268 .\" @@(#)$Id: mhook.rf,v 1.10 1992/02/10 20:00:15 jromine Exp jromine $
271 status set by \fIbiff\fP\0(1).
277 @replace $USER with "username"
282 .\" @@(#)$Id: mhook.rf,v 1.9 1992/02/03 18:11:52 jromine Exp jromine $
285 mhook \- MH receive\-mail hooks
288 $HOME/\&.maildelivery
298 .ds SL the local channel
310 rather the hook is invoked on your behalf by \fIMH\fR.
313 rather the hook is invoked on your behalf by \fIMMDF\fR
314 when you (symbolically) link @@(MHETCPATH)/slocal to the file
315 bin/rcvmail in your home directory.
318 rather the hook is invoked on your behalf by \fIMMDF\fR.
321 rather the hook is invoked on your behalf by \fISendMail\fR,
322 when you include the line
325 \*(lq| @@(MHETCPATH)/slocal -user username\*(rq
328 in your \&.forward file in your home directory.
332 The \fI\&.maildelivery\fR file,
333 which is an ordinary ASCII file,
334 controls how local delivery is performed.
335 This file is read by \*(SL.
336 .if '\*(ZS'slocal' \{\
338 The format of each line in the \fI\&.maildelivery\fR file is
341 \fBfield pattern action result string\fR
349 The name of a field that is to be searched for a pattern.
350 This is any field in the headers of the message that might be present.
351 In addition, the following special fields are also defined:
353 \fIsource\fR: the out\-of\-band sender information
355 \fIaddr\fR: the address that was used to cause delivery to the recipient
357 \fIdefault\fR: this matches \fIonly\fR if the message hasn't been delivered yet
359 \fI*\fR: this always matches
365 The sequence of characters to match in the specified field.
366 Matching is case\-insensitive but not RE\-based.
371 The action to take to deliver the message.
376 \fIfile\fR or \fI>\fR:
378 Append the message to the file named by \fBstring\fR.
379 The message is appended to the file in the maildrop
380 format which is used by your message transport system.
381 If the message can be appended to the file,
382 then this action succeeds.
384 When writing to the file,
385 a new field is added:
388 Delivery\-Date:\ date
390 which indicates the date and time that message was appended to the file.
395 Identical to \fIfile\fR,
396 but always appends the message using the format used by \fIpackf\fR
397 (the MMDF mailbox format).
400 \fIpipe\fR or \fI|\fR:
402 Pipe the message as the standard input to the command named by \fBstring\fR,
403 using the Bourne shell \fIsh\fR\0(1) to interpret the string.
404 Prior to giving the string to the shell,
405 it is expanded with the following built\-in variables:
407 $(sender): the return address for the message
409 $(address): the address that was used to cause delivery to the recipient
411 $(size): the size of the message in bytes
413 $(reply\-to): either the \*(lqReply\-To:\*(rq or \*(lqFrom:\*(rq field
416 $(info): miscellaneous out\-of\-band information
419 When a process is invoked, its environment is:
420 the user/group id:s are set to recipient's id:s;
421 the working directory is the recipient's directory;
423 the process has no /dev/tty;
424 the standard input is set to the message;
425 the standard output and diagnostic output are set to /dev/null;
426 all other file\-descriptors are closed;
427 the envariables \fB$USER\fR, \fB$HOME\fR, \fB$SHELL\fR are set
429 and no other envariables exist.
431 The process is given a certain amount of time to execute.
432 If the process does not exit within this limit,
433 the process will be terminated with extreme prejudice.
434 The amount of time is calculated as ((size x 60) + 300) seconds,
435 where size is the number of bytes in the message.
437 The exit status of the process is consulted in determining the success of the
439 An exit status of zero means that the action succeeded.
440 Any other exit status (or abnormal termination) means that the action failed.
442 In order to avoid any time limitations,
443 you might implement a process that began by \fIforking\fR.
444 The parent would return the appropriate value immediately,
445 and the child could continue on,
446 doing whatever it wanted for as long as it wanted.
447 This approach is somewhat risky if the parent is going to return an
449 If the parent is going to return a non\-zero exit status,
450 then this approach can lead to quicker delivery into your maildrop.
453 \fIqpipe\fR or \fI<caret>\fR:
455 Similar to \fIpipe\fR,
456 but executes the command directly,
457 after built\-in variable expansion,
458 without assistance from the shell.
463 This action always succeeds.
469 Indicates how the action should be performed:
476 If the action succeeds, then the message is considered delivered.
482 Regardless of the outcome of the action,
483 the message is not considered delivered.
488 Perform the action only if the message has not been delivered.
489 If the action succeeds, then the message is considered delivered.
494 Perform the action only if the message has not been delivered
495 and the previous action succeeded.
496 If this action succeeds, then the message is considered delivered.
500 The file is always read completely,
501 so that several matches can be made and several actions can be taken.
502 The \fI\&.maildelivery\fR file must be owned either by the user or by root,
503 and must be writable only by the owner.
504 If the \fI\&.maildelivery\fR file can not be found,
505 or does not perform an action which delivers the message,
506 then the file @@(MHETCPATH)/maildelivery is read according to the same rules.
507 This file must be owned by the root and must be writable only by the root.
508 If this file can not be found
509 or does not perform an action which delivers the message,
510 then standard delivery to the user's maildrop, @@(MHDROPLOC), is performed.
512 Arguments in the \fI\&.maildelivery\fR file are separated by white\-space or
514 Since double\-quotes are honored,
515 these characters may be included in a single argument by enclosing the
516 entire argument in double\-quotes.
517 A double\-quote can be included by preceeding it with a backslash.
519 To summarize, here's an example:
523 .ta \w'default 'u +\w'uk-mmdf-workers 'u +\w'action 'u +\w'result 'u
524 #\fIfield\fR \fIpattern\fR \fIaction\fR \fIresult\fR \fIstring\fR
525 # lines starting with a '#' are ignored, as are blank lines
527 # file mail with mmdf2 in the \*(lqTo:\*(rq line into file mmdf2.log
528 To mmdf2 file A mmdf2.log
529 # Messages from mmdf pipe to the program err-message-archive
530 From mmdf pipe A err-message-archive
531 # Anything with the \*(lqSender:\*(rq address \*(lquk-mmdf-workers\*(rq
532 # file in mmdf2.log if not filed already
533 Sender uk-mmdf-workers file ? mmdf2.log
534 # \*(lqTo:\*(rq unix \- put in file unix-news
535 To Unix > A unix-news
536 # if the address is jpo=mmdf \- pipe into mmdf-redist
537 addr jpo=mmdf | A mmdf-redist
538 # if the address is jpo=ack \- send an acknowledgement copy back
539 addr jpo=ack | R \*(lqresend\0\-r\0$(reply-to)\*(rq
540 # anything from steve \- destroy!
541 From steve destroy A \-
542 # anything not matched yet \- put into mailbox
543 default \- > ? mailbox
544 # always run rcvalert
550 .if '\*(ZS'mmdfII' \{\
551 See \fImaildelivery\fR\0(5) for the details.
554 Four programs are currently standardly available,
557 Its use is obsoleted by the \fI\&.maildelivery\fR.
560 .if '\*(ZS'slocal' \{\
561 rcvstore (1), mh\-format(5)
563 .if '\*(ZS'mmdfII' \{\
564 rcvstore (1), maildelivery(5), mh\-format(5)
568 .if '\*(ZS'slocal' \{\
570 For compatibility with older versions of \fIMH\fR,
571 if \fIslocal\fR can't find the user's \fI\&.maildelivery\fR file,
572 it will attempt to execute an old\-style rcvmail hook in the user's $HOME
575 it will first attempt to execute
578 \&.mh\(rureceive file maildrop directory user
580 failing that it will attempt to execute
583 $HOME/bin/rcvmail user file sender
585 before giving up and writing to the user's maildrop.
588 whenever a hook or process is invoked,
589 file\-descriptor three (3) is set to the message in addition to the standard
593 In addition to an exit status of zero,
594 the \fIMMDF\fR values \fIRP_MOK\fR (32) and \fIRP_OK\fR (9)
595 mean that the message has been fully delivered.
596 All other non\-zero exit status,
597 including abnormal termination,
598 is interpreted as the \fIMMDF\fR value \fIRP_MECH\fR (200),
599 which means \*(lquse an alternate route\*(rq
600 (deliver the message to the maildrop).
605 .if '\*(ZS'mmdfII' \{\
606 Versions of \fIMMDF\fR with the \fImaildelivery\fR mechanism aren't
607 entirely backwards\-compatible with earlier versions.
608 If you have an old\-style hook, the best you can do is to have a one\-line
609 \fI\&.maildelivery\fR file:
612 default \- pipe A \*(lqbin/rcvmail $(address) $(info) $(sender)\*(rq
624 .\" @@(#)$Id: mhook.rf,v 1.8 1990/04/05 22:18:43 sources Exp jromine $
627 \*(lq| @@(MHETCPATH)/slocal -user $USER\*(rq
638 .\" @@(#)$Id: mhook.rf,v 1.7 90/04/05 22:12:11 sources Exp Locker: sources $
641 The standard maildrop delivery process is used.
653 .\" @@(#)$Id: mhook.rf,v 1.6 90/04/05 15:13:25 sources Exp Locker: sources $
659 to override the default scan listing output format.
673 and gives the resulting output to the terminal access daemon for display
676 If the terminal access daemon is unavailable on your system,
677 then \fIrcvtty\fR will write the output to your terminal
678 if, and only if, your terminal has \*(lqworld\-writable\*(rq permission.
681 then the \fIrcvtty\fR program will give a one\-line scan listing
682 to the terminal access daemon.
688 rcvstore (1), maildelivery(5)
694 @put things back, do .NA stuff another way
708 .TH MHOOK 1 @@(MHCENTERFOOT) @@(MHLEFTFOOT)
723 If the action succeeded, then the message is considered delivered.
726 If the action succeeded, then the message is considered delivered.
732 @fixup for makewhatis
737 .TH MHOOK 1 [mh.6] MH