For any of you interested, here is a Perl script written by a very smart lady that reads the file events and schedule files and posts an email to an email address or addresses.
an empty file named email.txt is needed in the directory.
This is setup for NT using sendmail, but can easily be modified to work on UNIX.
##Author: Deborah Scott Dominey
##01/30/03
###################################
#This program sends an email listing
#events on the SEA Calendar.
#It must read data from two files:
#"schedule.txt" and "events.txt"
##################################
#NOTE: For the time calculations to
#be exactly correct, this job should
#be executed at 6AM each morning.
################################
#Write over old email message
################################
open(EMAIL_MESSAGE, ">d:/inetpub/wwwroot/Calendar/email.txt")| | die "Couldn't open email.txt";
################
#get current time
################
$t = time(); #This is epoch-system time
################
#convert current time to match different
#parts of "schedule.txt" and "events.txt"
################
$l = localtime;#This is date and time
$month = sprintf "%02d",((localtime)[4]+1);
$day = sprintf "%02d",((localtime)[3]);
################################
#Convert system time into mm/dd/yy format
################################
$datestamp = sprintf "%02d\/%02d\/%02d", ((localtime)[4]+1, (localtime)[3], (localtime)[5]%100);
################################
#Print the header for email message
################################
print EMAIL_MESSAGE "Today's Scheduled Events(as of $l):\n\n";
################################
#Get data from schedule.txt file
################################
open (SCHEDULE, "< d:/inetpub/wwwroot/Calendar/calendarscript/calendars/default/schedule.txt") | | die "Couldn't open schedule.txt";
while ()
{
@sched_rec = split(/\t/, $_);################################
#Third and fourth fields contain start and end times
#One day <86400 seconds> must be added to start time because
#the calendar program records the start time
#one day early
################################
$event_start_time = ($sched_rec[2] + 86400);
$event_end_time= $sched_rec[3];
################################
#The following calculation assumes that
#the email will be sent at 6AM each
#morning.
#
#To capture ONLY the events
#that occur from 12:00 AM-11:59PM --
#6 hours are subtracted from "current time"
#and 18 hours are added to "current time."
# NOTE: Start and end times use seconds
# because event.txt lists the
# duration of events in epoch time
################################
$day_start_time = time() - 21600;#current time minus 21600 seconds
$day_end_time = time() + 64800;#current time plus
if ( (( $sched_rec[6] == $month) && ($sched_rec[7] == $day)) | | (($event_start_time <= $day_end_time) &&
($event_end_time >= $day_start_time)) )
{
################################
#Open events.txt and match
#event_ids from schedule.txt.
#If event_id matches --
#print description in email.
################################
open (EVENT, " {
$event = 1; while ()
{
@event_rec = split(/\t/, $_);
if ( $event_rec[0] == $sched_rec[1] )
{
print EMAIL_MESSAGE " - $event_rec[2] $event_rec[3]\n";
}
}
}
} close(EVENT);
}
if ($event != 1){
print EMAIL_MESSAGE " - No events are listed on the calendar today.\n";
}
close EMAIL_MESSAGE;
################################
#send the contents of email.txt
#in an email message
################################
$file = "d:/inetpub/wwwroot/SENDMAIL/sendmail.exe";
$var = "d:/inetpub/wwwroot/Calendar/email.txt";
# undefining the input record separator causes the entire file to
# be slurped up into $f in one read. MUST BE DONE FOR NT MACHINES.
$/=undef;
open (FILE, "$var") | | die "can't open $var: $!";
$f=;
close(FILE);##open pipe to sendmail
@addressee=("email_address_goes_here");
foreach $i (@addressee) {
open(MAIL, "|$file $i") | | die "can't open sendmail";
print MAIL "To: $i\n" ;
print MAIL "From: SEA_Calendar\n" ;
print MAIL "Subject: Calendar for $datestamp\n" ;
print MAIL "$f" ;
foreach(@file){
print MAIL;
}
}
close ( MAIL ) | | die "Cannot close pipe to sendmail: $!";
close (SCHEDULE);
------------------