> I wrote a Perl script that runs a query against a MySQL db to > get a list of customer email > addresses. This script then takes a full email for input and > rewrites the 'To' header and > sends it with qmail-inject for each email address from the > db. I have an alias set up in > qmail that pipes anything sent through it into this script > that I wrote. This setup works > just fine, except when an email address no longer exists. The > MTA of the server where the > email no longer exists sends the failure notice to > alias@<myhost> instead of to > <originalsender>@<myhost>. Does anyone know why this is?
Something in the headers I bet. What do the qmail logs say? Is your script modifying the headers at all? > Also, does anyone see any ways I > could optimize my script? My script is below. > > > #!/usr/bin/perl > use DBI(); Just do use DBI; > > my $counter = 0; > my @email; > my $dbh = DBI->connect("DBI:mysql:database=<db>;host=<ip>", ...connect('DBI:mysql:Dbname:host','user','pass')... > "<username>", "<password>", > {'RaiseError' => 1}); > my $query = "SELECT fname, lname, homeemail, officeemail FROM > people WHERE current=1"; my $sth = $dbh->prepare($query); Instead of the prepare, execute, finish dance you could try one of the variouse versions of selectall_* I like to do this usually: for(@{$dbh->selectall_arrayref("SELECT foo,bar FROM JoeMama WHERE BenDover=0")}) { my ($foo,$bar) = @{$_}; Process record here } You can do that with a heash ref like you're using here. Simplfies it a bit for easier debugging, etc.. > $sth->execute(); > HTH DMuey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>