#!/bin/csh
##---------------------------------------------------
# NAME:   Send_Mail
#
# Purpose: Compose message file consisting of the message header,
#          Subject(must be surrounded by single quotes), and message
#          body, place it in the SMS inbox of the specified USERLOGIN.
#          Move message file to the ~/SMS/sent diectory.
#
# Arguments: 
#
#      $1 - receiver of message.
#      $2 - subject
# Work Files:
#
#      (1) header ... file containing mail message header
#      (2) date_string_file ... contains date string (timestamp)
#      (3) time_string_file ... contains time from timestamp.
#      (4) SUBJECT ... contains subject data
#    
# Output Files:
#
#      (1) msg_xxx_yyy_hhmmdd.new  ... message header file.
#      (2) SMSFILE  ... contains name of message file. 
#      (3) SMSBASE  ... contains base part of mail file name
#             msg___.
#      (4) MESSAGE ... contains concagnated info. 
#
# Usage:   SMS_make_mail_hdr_file receiver_login 'subject'
#
# Author: Demetricus Mosley
#
# Date:   July 22, 1997
#          
#
# 
#
##---------------------------------------------------
#
#-| Save user name and date, to be used in header and file name.
#
SMS_make_mail_hdr.csh $1
#
#-| Get date string. Strip out time and insert into file name.
#
set hh = `SMS_hour_of`
set mm = `SMS_min_of`
set ss = `SMS_sec_of`
#
#-| Make file name and copy header into file.
#
set filebase = msg_{$1}_{$user}_{$hh}{$mm}{$ss}
set filename = msg_{$1}_{$user}_{$hh}{$mm}{$ss}.new
if (-e $filename) rm $filename
cp header $filename
#
if (-e SMSBASE) rm SMSBASE
echo $filebase > SMSBASE
#
if (-e SMSFILE) rm SMSFILE
echo $filename > SMSFILE
#
if (-e SUBJECT) rm SUBJECT
echo SUBJECT: $2 > SUBJECT
echo "   " >> SUBJECT
pico BODY_MSG
#
if (-e MESSAGE) rm MESSAGE
cat header SUBJECT BODY_MSG > MESSAGE
cp MESSAGE $filename
cp $filename ~$1/SMS/inbox
mv $filename ~/SMS/sent
echo \*\*\* MAIL SENT to $1
exit

Back to Unix