Copyright Digital Equipment Corp. All rights reserved.

Example

   For example, suppose that BOB@SAMPLE.COM sends JIM@EXAMPLE.COM
   a message. JIM@EXAMPLE.COM has the following (rather complex)
   MAIL.DELIVERY file:

"*JIM@EXAMPLE.COM*"        * "Loopback" T D
*                          * "Loopback" O F """''F$ELEMENT(0,"" "",QFROM)'"""
*                          * "Loopback" T Q
*                          * *          A E @LOGALL.COM
"*TERRY@ISI.COM*"          * *          T Q
"*JIM@EXAMPLE.COM*"        * "Archives" T Q
"*BOB@SAMPLE.COM*"         * *          T A BOB.LOG
*                          * *          A D

   JIM@EXAMPLE.COM's LOGALL.COM contains the following commands:

$ from    == "From:    " + from
$ to      == "To:      " + to
$ subject == "Subject: " + subject
$ open/append/error=make_one x message.log
$ next:
$ write x ""
$ write x from
$ write x to
$ write x subject
$ write x ""
$ close x
$ append 'message_file' message.log
$ exit
$ !
$ make_one:
$ create message.log
$ open/append x message.log
$ goto next

   Note that a similar effect could be achieved by substituting

   *         * *          A H MESSAGE.LOG

   for

   *         * *          A E @LOGALL.COM

   but would log the entire header rather than a few selected lines.

   If the subject line of BOB@SAMPLE.COM's message is not the string
   "Loopback", the message will be logged with a header in the file
   MESSAGE.LOG (located in JIM@EXAMPLE.COM's SYS$LOGIN directory),
   appended to the file BOB.LOG without any header and delivered to
   JIM@EXAMPLE.COM's NEWMAIL folder. If subject line is the string
   "Loopback", JIM@EXAMPLE.COM's MAIL.DELIVERY file will bounce the
   message right back to BOB@.SAMPLE.COM.

   The F$ELEMENT DCL lexical function is used in this example to
   eliminate the personal name field from the address, if one is
   present. Care must be taken to deal with personal name fields
   attached to VMS MAIL addresses in a proper manner. The approach
   of using F$ELEMENT is simple and usually very effective; note
   that it can fail if the address part of the VMS MAIL header line
   contains spaces.

   As another example, if TERRY@ISI.COM sends a message to
   JIM@EXAMPLE.COM, the message is logged only in JIM@EXAMPLE.COM's
   MESSAGE.LOG file; JIM@EXAMPLE.COM never receives any notification
   that the message arrived. Apparently, TERRY@ISI.COM never says
   anything of importance to JIM@EXAMPLE.COM.

   It is clear that the ability to execute an arbitrary set of DCL
   commands in response to a message is a very powerful tool. It
   must, however, be used with care, since processing is initiated
   whenever a message is received and operates in a completely
   unattended environment.