home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / softsys / andrew / 1221 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  15.9 KB

  1. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!ANDREW.CMU.EDU!gk5g+
  2. From: gk5g+@ANDREW.CMU.EDU (Gary Keim)
  3. Newsgroups: comp.soft-sys.andrew
  4. Subject: Re: AMS Filtering
  5. Message-ID: <0edXSRe00Woh5D=Q1Y@andrew.cmu.edu>
  6. Date: 3 Sep 92 16:04:45 GMT
  7. References: <9209031359.AA10022@gingko.cs.Virginia.EDU>
  8. Sender: daemon@ucbvax.BERKELEY.EDU
  9. Distribution: world
  10. Organization: The Internet
  11. Lines: 387
  12.  
  13. Excerpts from misc: 3-Sep-92 AMS Filtering swh2y@gingko.cs.Virginia (165)
  14.  
  15. > I need some more information on Andrew Message System
  16. > filtering. Do you know of any papers, tech reports, etc.
  17. that specifically talks about filtering?
  18.  
  19. Here the help file for the flames language:
  20. FLAMES: 
  21. Filtering Language for the Andrew Message System
  22.  
  23. What is FLAMES?
  24.  
  25.     FLAMES is an "extension language" for the Andrew Message System. 
  26.     You can use FLAMES to write a LISP-like program that will
  27.     automatically classify your incoming mail.
  28.  
  29.     What can FLAMES do?  FLAMES can act on any message that arrives in
  30.     your Mailbox.  It acts on them as you read your mail--as messages in
  31.     your Mailbox are moved into appropriate folders.  For example, you
  32.     can write a FLAMES file that will sort mail from certain people into
  33.     certain folders, or you can automatically post messages with special
  34.     addresses that arrive in your Mailbox to a private bulletin board
  35.     you maintain.  You can also reject mail--that is, bounce it back to
  36.     the sender--if you consider it "junk" mail, or you can automatically
  37.     resend mail to additional destinations.
  38.  
  39.     What can't FLAMES do?  Eventually, FLAMES will support all kinds of
  40.     actions on the message database, but now it can only classify
  41.     incoming mail as it is processed while reading it out of your
  42.     Mailbox.  This means that you can't use FLAMES to manipulate
  43.     messages on bulletin boards (because the messages don't go through
  44.     your Mailbox), and that you have to read your mail for the messages
  45.     in your Mailbox to be processed.
  46.  
  47. Do I need to be a programmer to use FLAMES?
  48.  
  49.     No.  This help file contains several useful "cookbook" programs, as
  50.     well as instructions and examples illustrating how to modify them,
  51.     so even if you are not a programmer, you, too, can automatically
  52.     classify your incoming mail.  The programs (A and B) in this file
  53.     will let you do the following:
  54.  
  55.     A.  Classify mail into any folder (a top level folder, like
  56.     "friends," or a sub-folder, like "friends.foo") by defining keywords
  57.     that FLAMES will search for in the message headers.  The keywords
  58.     can be anything, such as portions of an address, like "userid+foo."
  59.  
  60.     B.  Classify mail into a sub-folder (like "friends.foo") by the
  61.     incoming address (userid+foo@andrew.cmu.edu) with the capability of
  62.     sending rejection messages and folder creation notices.
  63.  
  64.     Both of these programs will let you process mail for a private
  65.     bboard.  See  privatebb  for more information about creating a
  66.     private bboard.
  67.  
  68. What if I am a programmer?
  69.  
  70.     If you are a programmer and want to learn about FLAMES, you will
  71.     need to know how to program in LISP.   None of the help files on
  72.     Andrew will teach you how to program in LISP.  In order to learn
  73.     about LISP, you will have to get yourself a good book about LISP and
  74.     learn from there.  There are many available.
  75.  
  76.     In addition to LISP, there is programming information specific to
  77.     FLAMES that you should know about in:
  78.  
  79.     /usr/andrew/doc/ams/Flames.pgr
  80.  
  81.     You may also want to look at the simple program examples below; they
  82.     could save you the trouble of "reinventing the wheel."
  83.  
  84. Program A: Classifying incoming mail by keyword
  85.  
  86.     It is very easy to use FLAMES to classify your new mail into folders
  87.     according to keywords you define and apply to headers in your mail. 
  88.     For example, the "keywords" you define can be people's names (or
  89.     user ids), which you would apply to the "From" header.   Then, any
  90.     mail from the person you specify would be automatically classified
  91.     into a particular personal folder.
  92.  
  93.     Note that for the example program in this section, the folder(s) you
  94.     want to classify messages into need not already exist; the folder(s)
  95.     will be created for you automatically.  See the  messages-folders 
  96.     help file for more information on folders.
  97.  
  98.     Copy the program.  Complete the following steps carefully to copy
  99.     the program.
  100.  
  101.     1.  Edit a file in your home directory called:
  102.  
  103.         .AMS.flames
  104.  
  105.     This is your FLAMES file.  Once this file is created, every time you
  106.     start an Andrew Message System program (Messages, CUI, VUI, or
  107.     batmail), or read your new mail from within one of these programs
  108.     that is already running, this file will be read.  
  109.  
  110.     2.  Copy the following code between the lines of semi-colons into
  111.     your .AMS.flames file using Copy and Paste from the menus.  Make
  112.     sure there is a blank line at the end of the file.
  113.  
  114.     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  115.  
  116.     (defun my-mail-hook (msg)
  117.       (post-by-keyword
  118.        msg
  119.        "mail"
  120.        '(
  121.          (("header1")("keyword1" "keyword2")("folder"))
  122.          )))
  123.  
  124.     (load "flib") ; The standard flames library
  125.  
  126.     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  127.  
  128.     Make sure there are no styles in the file by selecting the whole
  129.     text and choosing Plainest from the pop-up menus..
  130.  
  131.     Modify the program.  To make the program work, you need to change
  132.     four parts of the program.
  133.  
  134.     Note that whenever you change your .AMS.flames file and Save it, you
  135.     do not need to restart the Andrew Message System program you are
  136.     using for the changes you have made to take effect.
  137.  
  138.     1.  You need to change "my-mail-hook" in the first line to a unique
  139.     name.  For example, you might substitute your user id for "my".
  140.  
  141.         Example.  The following line would make the flames file unique
  142.         for Jello Biafra, whose user id is jbRo.
  143.  
  144.         (defun jbRo-mail-hook (msg)
  145.  
  146.     2.  You need to change "header" to be the mail header you want
  147.     FLAMES to scan for keywords.  The header you specify must be
  148.     lowercase.  For example, you might want FLAMES to scan the "from"
  149.     header.  (See the Example after step 4, below.)
  150.  
  151.     3.  You need to change "keyword1" and "keyword2" to the keywords you
  152.     want FLAMES to look for.  These keywords are regular expressions.  
  153.     Among other things, this means that the keywords are case sensitive
  154.     ("a" is not the same as "A").  They can be a substring of a longer
  155.     string.  For example, you might want FLAMES to look for user ids, or
  156.     names of people who send mail to you.  You would not need to include
  157.     their whole mail address as a keyword ("jbRo+@andrew.cmu.edu"), but
  158.     only a unique part ("jbRo").  
  159.  
  160.     Note that the "+" character in these regular expressions is "magic";
  161.     it means "match 1 or more of the expressions immediately preceding
  162.     me."  So, the regular expression "jbRo+carbons" used as a keyword,
  163.     matches the strings "jbRocarbons", "jbRoocarbons", "jbRooocarbons",
  164.     etc.  It does not match the string "jbRo+carbons", which is often
  165.     what is desired.  In order to remove the magic significance of the
  166.     "+", precede it with 2 backslashes, as in "jbRo\\+carbons".  If you
  167.     want to know why there are two backslashes instead of one, see the
  168.     documentation in
  169.  
  170.         /usr/andrew/doc/eli/regexp.doc
  171.  
  172.     See the Examples after number 4, below, for example lines that do a
  173.     number of these things.
  174.  
  175.     4.  You need to change "folder" to be the name of a personal mail
  176.     folder into which you want the messages placed.  Folder names are
  177.     also case sensitive.  (See the  messages-folders  help file if you
  178.     do not already have folders.)  For example, you might want messages
  179.     placed in a folder called "friends."
  180.  
  181.         Example.  The following line in the program would put messages
  182.         from jbRo and eeKr into a folder called friends.
  183.  
  184.         (("from" "sender") ("jbRo" "eeKr") ("friends"))
  185.  
  186.     You can have messages with a folder address (userid+foldername)
  187.     filed into a folder by preceeding the + sign in the keyword with 2
  188.     backslashes.
  189.  
  190.         Example.  The following line in the program would put messages
  191.         addressed to jbRo+dictionary@andrew.cmu.edu into your folder
  192.         called dictionary.
  193.  
  194.         (("to" "cc" "received") ("jbRo\\+dictionary") ("dictionary"))
  195.  
  196.         Example.  The following line in the program would put messages
  197.         addressed to jbRo+dictionary.round2@andrew.cmu.edu into your
  198.         folder called dictionary.round2.
  199.  
  200.         (("to" "cc" "received") ("jbRo\\+dictionary.round2")
  201.         ("dictionary.round2"))
  202.  
  203.     You can have different numbers of headers, keywords or folders in
  204.     this line from the program.  If you want to add more headers,
  205.     keywords or folders, make sure that they are quoted, have spaces
  206.     between them and other elements, but no spaces next to the
  207.     parentheses.
  208.  
  209.         Example.  The following line in the program would put messages
  210.         from zz1z into a folder called junk.
  211.  
  212.         (("from" "sender") ("zz1z") ("junk"))
  213.  
  214.     You can add several lines like the one above if you want to have
  215.     multiple classifications.   Make sure you have parentheses in the
  216.     right places.
  217.  
  218.         Example. The following example of the program would put messages
  219.         from jbRo and eeKr into friends, and messages from zz1z into
  220.         junk.  
  221.  
  222.         (defun flames-key-personal-mail (msg)
  223.           (post-by-keyword
  224.              msg
  225.              "mail"
  226.              '(
  227.                (("from" "sender") ("jbRo" "eeKr") ("friends"))
  228.                (("from" "sender") ("zz1z") ("junk"))
  229.                )))
  230.  
  231.         (load "flib") ; The standard flames library
  232.  
  233.     You can also search other headers for keywords.
  234.  
  235.         Example.  The following example searches the "subject" header
  236.         for the keywords "business," "boredom," and "tedium" and files
  237.         messages it finds with those keywords into the folder called
  238.         work, as well as doing what the example above does with messages
  239.         from jbRo, eeKr, and zz1z.
  240.  
  241.         (defun flames-key-personal-mail (msg)
  242.           (post-by-keyword
  243.              msg
  244.              "mail"
  245.              '(
  246.                (("subject") ("business" "boredom" "tedium") ("work"))
  247.                (("from" "sender") ("jbRo" "eeKr") ("friends"))
  248.                (("from" "sender") ("zz1z") ("junk"))
  249.                )))
  250.  
  251.         (load "flib") ; The standard flames library
  252.  
  253. Program B: Classifying incoming mail by address
  254.  
  255.     If you get mail with an address that looks like 
  256.  
  257.         userid+foldername@andrew.cmu.edu
  258.  
  259.     it probably comes to your Mailbox.  That is because the AMS delivery
  260.     system completely ignores anything in an address between the "+" and
  261.     the "@".  Thus, user Jello Biafra (user id "jbRo") can have mail
  262.     sent to "jbRo+movies@andrew.cmu.edu" and it will show up in his
  263.     Mailbox.
  264.  
  265.     Using FLAMES, you can exploit this fact.  For example, if you
  266.     maintain a private bulletin board, you can have the messages that
  267.     are sent to the bulletin board via your Mailbox be placed in the
  268.     folder (posted there) automatically every time you read your mail. 
  269.     Or, if you subscribe to a mailing list, you can subscribe using a
  270.     certain address (e.g. "userid+list-name@site-domain") and then,
  271.     using FLAMES, automatically classify messages from that mailinglist
  272.     into a separate folder.
  273.  
  274.     Note that classifying mail by address does not work for users on
  275.     systems not running the AMS Delivery System.
  276.  
  277.     Copy the program.  Complete the following steps carefully to copy
  278.     the program.
  279.  
  280.     1.  Edit a file in your home directory called:
  281.  
  282.         .AMS.flames
  283.  
  284.     This is your FLAMES file.  Once it is created, every time you start
  285.     an Andrew Message System program (e.g., Messages, CUI, VUI, or
  286.     batmail), or read your new mail from within one of these programs
  287.     that is already running, this file will be read in and executed over
  288.     each of your new messages in turn.
  289.  
  290.     2.  Copy the following code between the lines of semi-colons into
  291.     your .AMS.flames file using Copy and Paste from the menus.  Make
  292.     sure there is a carriage return at the end of the file.
  293.  
  294.     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  295.  
  296.     (defun my-mail-hook (msg)
  297.       (standard-mapping 
  298.         msg 
  299.         "treeroot" 
  300.         "defaultfolder" 
  301.         "rejectto" 
  302.         "rejectcc" 
  303.         "rejectmessage"))
  304.  
  305.     (load "flib") ; standard flames library
  306.  
  307.     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  308.  
  309.     Make sure there are no styles in the file by selecting the whole
  310.     text and choosing Plainest from the pop-up menus.
  311.  
  312.     Modify the program.  To make the program work, you need to change
  313.     six parts of the program. 
  314.  
  315.     Note that when ever you change your .AMS.flames file and Save it,
  316.     you do not need to restart the Andrew Message System program you are
  317.     using for the  changes you have made to take effect.
  318.  
  319.     1.  You need to change "my-mail-hook" in the first line to a unique
  320.     name.  For example, you might substitute your user id for "my".
  321.  
  322.     2.  You need to change "treeroot" to be the folder which is the
  323.     parent for the suffix of your address.  For example, if you specify
  324.     the folder "bboard" as the treeroot, then messages that come to you
  325.     addressed to "userid+foo@andrew.cmu.edu" would be filed into a
  326.     folder called "bboard.foo".  If "bboard.foo" does not exist, it will
  327.     be created, and a folder creation announcement will be put into the
  328.     parent folder, "bboard".  However, you must create the treeroot
  329.     folder yourself.
  330.  
  331.     3.  You need to change "defaultfolder" to the folder where all
  332.     messages without a suffix in the address should go.  The standard
  333.     default folder is "mail".
  334.  
  335.     The last three things you need to change are to tell FLAMES what to
  336.     do if a suffix names a folder that does not exist and can't be
  337.     created.  In such cases, the mail will be rejected.  This means that
  338.     a message will be composed and sent to someone saying that the mail
  339.     could not be placed in the folder where it was requested to go.  
  340.  
  341.     4.  You need to change "rejectto" to an address which the rejection
  342.     message will be sent to.  There are several options for this field:
  343.  
  344.         NIL (without quotes) sends the rejection message back to the sender,
  345.         "" sends no rejection message at all,
  346.         an address sends the rejection message to the address.
  347.  
  348.     5.  You need to change "rejectcc" to an address which a copy of the
  349.     rejection message will be sent to.  There are several options for
  350.     this field:
  351.  
  352.         NIL (without quotes) sends a copy of the rejection message
  353.             to the user "BBoard.Maintainer".
  354.         "" sends sends a copy of the rejection message to the user
  355.             "BBoard.Maintainer".
  356.         an address sends a copy of the rejection message to that address.
  357.  
  358.     6.  You need to change "rejectmessage" to be the text of the
  359.     rejection message.  For example, you might use the following as a
  360.     rejection message "Illegal personal folder name for userid."
  361.  
  362.         Example.  This function will take messages addressed to 
  363.  
  364.             jbRo+round2@andrew.cmu.edu
  365.  
  366.         and put them into Jello's folder called "dictionary.round2". 
  367.         Rejection messages are sent back to the sender, and to Jello's
  368.         folder called "dictionary.rejections".
  369.  
  370.         (defun jbRo-mail-hook (msg)
  371.           (standard-mapping 
  372.             msg 
  373.             "dictionary"
  374.             "mail"
  375.             NIL
  376.             "jbRo+rejections@andrew.cmu.edu" 
  377.             "Illegal personal folder name for Jello Biafra"))
  378.  
  379.         (load "flib") ; standard flames library
  380.  
  381. Program Author
  382.  
  383.     Bob Glickstein, Nathaniel Borenstein
  384.  
  385. Related tools  
  386.  
  387. The following document is available on Flames.  You can use EZ to view it.
  388.  
  389.     /usr/andrew/doc/ams/Flames.pgr
  390.  
  391. Select (highlight) one of the italicized names and choose "Show Help on
  392. Selected Word" from the pop-up menu to see the help file for:
  393.  
  394.     +
  395.     eli                 an Embedded LISP Interpreter
  396.     privatebb           create a private bboard
  397.     Messages
  398.     messages-folders
  399.     ams                 some technical aspects of the AMS
  400.