From: Blake C. <li...@li...> - 2006-01-20 18:14:12
|
Funny you should ask, I *just* wrote this thing that seems to do a decent job. It dropped my bounces from around 600 to about 20. First, this is a really bad way to harvest emails, but it catches most of them. I run qmail, so this works for for me, no idea how you'd do it elsewhere grep \<.*\> /home/vpopmail/domains/0/lisnews.com/btcarver/Maildir/.Bounces/cur/* | sed 's/ *(.*)//; s/>.*//; s/.*[:<] *//' | sort | uniq >emails.txt Then this just opens that file and reads the emails. I think it should work on any other slash databases. --------------------- #!/usr/bin/perl use DBI; $dbh = DBI->connect("dbi:mysql:database=database;host=localhost;user=user;password=password") or die "Couldn't connect to database: $DBI::errstr\n"; open (EMAILS, "emails.txt"); while ($email = <EMAILS>) { chomp($email); print "\n$email\n"; $sql = "select uid from users where realemail like '%$email%'"; print $sql; $sth = $dbh->prepare($sql); $sth->execute || die "Doh"; $RecordData = $sth->fetchrow_hashref(); $uid = $RecordData->{'uid'}; if($uid) { foreach($uid) { print "\ndeleted $uid\n"; $sql = "delete from users_messages where uid = $uid and (code = 1 or code = 0)"; $sth = $dbh->prepare($sql); $sth->execute || die "Doh"; } } } -------------- Blake Carver LISNews.org Librarian & Information Science News http://www.lisnews.org ----- Original Message ----- From: "Eric Dannewitz" <eri...@ja...> To: <sla...@li...> Sent: Thursday, January 19, 2006 11:27 AM Subject: [Slashcode-development] Script to disable headlines? > Does anyone have a perl script to set email address not to receive email? > I have a lot of email address that bounce when my slash site sends out > daily stories, and I'd like an easy way to set these addresses to not > receive the daily headlines. > > Thanks > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Slashcode-development mailing list > Sla...@li... > https://lists.sourceforge.net/lists/listinfo/slashcode-development > > |