Hi All,

This is my first script, actually part 2 of the first.   I 
triumphantly :) created a script to write data from a simple form to 
a flat-tile database.  Now I would like to be able to send everyone 
on the list an email when my client's site is updated.  Below is what 
I've got.  Assuming it will work, what is the best way to call the 
script?  I've tried clienturl/cgi-bin/sendupdate.cgi but only get a 
404 error.  I've read cgi101 by Jaqueline Hamilton, Perl and CGI by 
Elizabeth Castro and Perl 5 for Web Professionals--Learning Perl is 
next I suppose.  Anyhow, that's where I'm at.

Thank you for any comments.

takayuki


#!/usr/bin/perl
#sendupdate.cgi


$mailprogram="/usr/lib/sendmail";

open(INFO,"data.db") or &dienice("Couldn't open $mailprogram!\n");
flock(INFO,2);  #locks file so another cgi can write to it at the same time
@thedata = <INFO>;
close(INFO);

foreach $line (@thedata) {
     chomp($line);
 
($fname,$lname,$email,$number,$address,$home_interested_in,$price_range,$comments) 
= split(/\|/,$line);

open(MAIL,"|$mailprogram -t") or &dienice("Couldn't send mail.");
     print MAIL "To: $email\n";
     print MAIL "Subject: the site has been update\n\n";
     print MAIL "From: [EMAIL PROTECTED]\n";
     print MAIL <<redskins;
     Hello $fname,

     The site has just been updated!

     Best Regards,

     Takayuki

redskins

     close(MAIL);  #sends mail
     }

sub dienice{
      my($msg)=@_;
      print "<h3>Oops</h3>\n";
      print $msg;
      exit;
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to