#!/usr/bin/perl -w use strict; use CGI; use DBI; # Declare and initialize variables my $host = 'hostname'; my $db = 'dbname'; my $db_user = 'dbuser'; my $db_password = 'mypassword'; my $dbh = DBI->connect("dbi:mysql:$db:$host", "$db_user", "$db_password" or die "Couldn't connect: $DBI::errstr"); my $sth = $dbh->prepare("SELECT * FROM feRegistrants" or die "Couldn't prepare SQL: $DBI::errstr"); $sth->execute or die "Couldn't execute statement: " . $sth->errstr; my @data; while (@data = $sth->fetchrow_array()) { my $email = $data[5]; my $fname = $data[2]; print "Content-type:text/html\n\n"; open(MAIL, "|/usr/lib/sendmail -t -n") || die "Unable to open sendmail"; print MAIL "To: $email \nFrom: the server\n"; print MAIL "Subject: Subject\n"; print MAIL<disconnect();