home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / word / text / 019 / mail.sl < prev    next >
Text File  |  1993-01-19  |  2KB  |  79 lines

  1. ;;
  2. ;;  This file should only be loaded on unix systems.  It opens a
  3. ;;   process to /usr/ucb/mail.  I am sure it can be easily modified
  4. ;;   for other mail programs.
  5. ;;
  6.  
  7.  
  8. (
  9.   [mail_cmd to subj beg]  "" =subj "" =to
  10.   
  11.    push_spot
  12.    bob
  13.    
  14.    "---text follows this line---" fsearch
  15.      {
  16.        pop_spot
  17.        "Failed to find text divider." error
  18.      } !if
  19.  
  20.    whatline =beg 
  21.    bob
  22.    beg 
  23.    {
  24.        bol "To:" looking_at {
  25.          3 right pop
  26.      push_mark eol bufsubstr =to
  27.        } if
  28.        bol "Subject:" looking_at {
  29.          8 right pop
  30.      push_mark eol bufsubstr =subj
  31.        } if
  32.        1 down pop
  33.     } loop
  34.     
  35.    to strlen { pop_spot "Bad To: field." error } !if
  36.    
  37.    ;; mail command --- use sugar coated interface
  38.    
  39.    "/usr/ucb/mail -s \"" subj strcat "\" "  strcat to strcat =mail_cmd
  40.    
  41.    beg goto_line
  42.    1 down { pop_spot "No message!" error } !if
  43.    
  44.    push_mark
  45.    eob
  46.    "Sending..." message flush
  47.    mail_cmd pipe_region {
  48.       "Sending...done"  message
  49.       0 set_buffer_modified_flag
  50.    } {
  51.       "No message sent." message
  52.    } else
  53.    
  54.    pop_spot
  55.    
  56. ) send
  57.  
  58.  
  59. (
  60.    [mail_buf old]  "*mail*" =mail_buf
  61.    
  62.    mail_buf bufferp =old
  63.    mail_buf pop2buf
  64.    
  65.    
  66.    ;; if buffer is not old, turn autosave on
  67.    old { 
  68.       getbuf_info pop 2 setbuf_info
  69.    } !if
  70.    
  71.    old {getbuf_info 1 & {pop pop pop return} if pop pop pop } if
  72.    
  73.    erase_buffer
  74.    "wrap" setmode
  75.    "To: \nSubject: \n---text follows this line---\n" insert
  76.    bob eol
  77.    0 set_buffer_modified_flag
  78. ) mail
  79.