$ SAVERIFY = 'F$VERIFY(0)' ! Save and turn off verify $!----------------------------------------------------------------------------+ $! MAIL_EDIT.COM - Used when editing mail to send; quote and spell check | $!----------------------------------------------------------------------------+ $! To use this procedure, you should place this in SYS$LOGIN:LOGIN.COM: $! $! $ MAI*L == "MAIL/EDIT=(SEND,REPLY=EXTRACT,FORWARD)" $! $ DEFINE MAIL$EDIT SYS$LOGIN:MAIL_EDIT.COM $! $! This file should be in SYS$LOGIN and called MAIL_EDIT.COM. If a file $! MAIL_EDIT.SIG exists there as well, it will automatically be appended $! to the end of the message as a signature after you exit your edit and $! spelling checking sessions. $! $! Note: If you're a system manager, you'll find a better MAIL_EDIT that $! uses TPU in [ANONYMOUS] on narnia.memst.edu. It'll even work $! for captive accounts (which this one will not). $! $!----------------------------------------------------------------------------+ $! You may re-define the following symbols to suit personal preference | $!----------------------------------------------------------------------------+ $ QUOTE_CHR = "> " !> Quote character(s) $ EDIT_CMD = "EDIT/EDT" !> Edit command: *must* accept $! /READ_ONLY and /OUTPUT qualifiers like EDIT/EDT, EDIT/TPU, and LSEDIT $ SIG_FILE = "SYS$LOGIN:MAIL_EDIT.SIG" !> Name of signature file $ SPELL_CHECK = "TRUE" !> SPELL invokes spelling check $! Define as TRUE if Vassar or DEC SPELL are installed; FALSE otherwise. $ SMTP_SKIP = "TRUE" !> Skip to first blank line in $! "foreign" mail messages. Intended to skip SMTP internal mail headers. $! Define as TRUE if you want internal headers stripped from replies, $! FALSE otherwise. Note that some mail systems may be configured to $! place the header at the end, and others (like DSN) use the foreign $! mail interface without internal headers; these need FALSE. $!----------------------------------------------------------------------------+ $! End of directions and user-modifiable parameters. | $!----------------------------------------------------------------------------+ $! $ IF F$TRNLNM("SYS$INPUT",,,"USER",,"ACCESS_MODE") .EQS. "USER" THEN - DEASSIGN/USER_MODE SYS$INPUT ! Just in case $ IF P1 .EQS. P2 ! READ/EDIT; no quote or spell $ THEN DEFINE/USER SYS$INPUT SYS$COMMAND ! Re-direct input for edit $ 'EDIT_CMD'/READ_ONLY 'P2' ! Edit the message to read $ EXIT 1 + 0*F$VERIFY(SAVERIFY) ! Exit with success $ ENDIF ! EndIf READ/EDIT $ IF P1 .EQS. "" THEN GOTO NO_INPUT ! SEND; no input, no quote $ IF F$LOCATE("_EDIT.TMP",P1) .EQ. F$LENGTH(P1) THEN GOTO NO_QUOTE $ WRITE SYS$OUTPUT "Quoting mail message with ""''QUOTE_CHR'""..." $ OPEN/READ/ERR=FINISHED INFIL 'P1' ! Open input file $ CREATE 'P1' ! Create new input text file $ OPEN/READ/WRITE/ERR=FINISHED OUTFIL 'P1' ! Open new input file $ READ/END=DONE INFIL LINE ! Line #1: From $ SMTP_SKIP = (F$LOCATE("%",LINE) .NE. F$LENGTH(LINE)) .AND. SMTP_SKIP $ WRITE OUTFIL QUOTE_CHR + LINE ! Write out From $ READ/END=DONE INFIL LINE ! Line #2: To (skip) $ READ/END=DONE INFIL LINE ! Line #3: CC (skip) $ READ/END=DONE INFIL LINE ! Line #4: Subject $ WRITE OUTFIL QUOTE_CHR + LINE ! Write out Subject $ READ/END=DONE INFIL LINE ! Line #5: blank $ WRITE OUTFIL "" ! Write out blank line $ LOOP: ! Loop for rest of file $ READ/END=DONE INFIL LINE ! Get a line $ IF SMTP_SKIP ! Are we skipping this? $ THEN LINE = F$EDIT(LINE,"TRIM") ! Blank line for end of garbage $ IF LINE .EQS. "" THEN SMTP_SKIP = "FALSE" ! Don't skip anymore $ GOTO LOOP ! Get another line $ ENDIF ! EndIf SMTP skip $ WRITE OUTFIL QUOTE_CHR + LINE ! Quote and write out line $ GOTO LOOP ! Get another line $ DONE: ! We're done quoting input file $ CLOSE/NOLOG INFIL ! Close original input file $ CLOSE/NOLOG OUTFIL ! Close new input file $ PURGE/NOLOG/NOCONFIRM 'P1' ! Purge input file $ NO_QUOTE: ! For SENDing an existing file $ DEFINE/USER SYS$INPUT SYS$COMMAND ! Re-direct input for edit $ 'EDIT_CMD'/OUTPUT='P2' 'P1' ! Edit the message to send $ GOTO FINISHED ! All finished editing $ NO_INPUT: ! No input file specified $ DEFINE/USER SYS$INPUT SYS$COMMAND ! Re-direct input for edit $ 'EDIT_CMD' 'P2' ! Edit the message to send $ FINISHED: ! All finished editing $ CLOSE/NOLOG INFIL ! Close input files just to $ CLOSE/NOLOG OUTFIL ! be on the safe side $ IF F$SEARCH(P2) .NES. "" ! Check for mail message $ THEN IF SPELL_CHECK ! Spelling corrector installed? $ THEN DEFINE/USER SYS$INPUT SYS$COMMAND ! Re-direct input $ SPELL 'P2' ! Correct spelling errors $ ENDIF ! EndIf spell correcting $ IF F$SEARCH(SIG_FILE) .NES. "" THEN APPEND 'SIG_FILE' 'P2' !sig $ PURGE/NOLOG/NOCONFIRM 'P2' ! Purge older version(s) $ ENDIF ! EndIf message exists $ EXIT 1 + 0*F$VERIFY(SAVERIFY) ! Exit with success $! $!----------------------------------------------------------------------------+ $! A few notes about signature files | $!----------------------------------------------------------------------------+ $! Signature files should contain a blank line or a line with "--" only $! followed by (at most) four lines of information. This is common $! network curtesy: to be sensitive to bandwith restrictions and give $! a replyable address (which what appears in "From:" for different $! mailers may not be). Also, as in the body of the mail message, you $! should restrict yourself to 78 characters or less per line. Here's $! an example: $! -- $! Harry Flowers Internet: FLOWERS@MEMSTVX1.MEMST.EDU $! Memphis State University & Bitnet: FLOWERS@MEMSTVX1