#!/usr/local/bin/perl #Change this line to point to your version of perl #NON-CGI mailing program #illustrates how perl is used to control other unix processes #and how it can be interfaced with email #set up constant for mail program. Change this to point to your version #of sendmail. Note the single quotes $mailprog = '/usr/lib/sendmail'; #note the use of \@ Without this, perl thinks @cs is some kind of array(!) $recipient = "aharris\@cs.iupui.edu"; #send the mail open (MAIL, "|$mailprog $recipient") || die ("couldn't open $mailprog! \n"); print MAIL "Subject: ALERT \n\n"; print MAIL "Message: \n"; # note the . is the way you concatenate strings print MAIL "\n \n"; # It's a good idea to place a couple extra newlines after the word message: print MAIL "Somebody ran the mail.pl program. \n"; print MAIL "What do we do?\n"; print MAIL " - much love,"; print MAIL " Narcissus"; print MAIL "\n \n"; close (MAIL);