In the database is id, reason, action.
In this script I am cycling through a set of records and for each record I check to see what is in reason (which is why there is the if statements if ($reason =~ /MAILBOX FULL/i) )
Instead of having MAILBOX FULL hard coded, it will be in the database that is queried and dumped into an array containing other entries that were once hard coded.
Main Topics
Browse All Topics





by: Adam314Posted on 2007-05-29 at 09:43:15ID: 19173619
What information is in the database table bouncerules? sql) or die $DBI::errstr;
Do you want to check if $reason is in one of the records of bouncerules? If so:
$sql = "SELECT * FROM bouncerules";
$rules = $dbh->selectall_arrayref($
my $found=0;
foreach (@{$rules}) {
$found=1 if $reason =~ /$_->[0]/;
}
if($found){print "reason is in the database\n";}
else {print "reason is not in the databse\n";}