[thelist] Removing Bounced Emails from PHP Mailing Lists

David Bindel dbindel at austin.rr.com
Tue Jul 15 17:29:24 CDT 2003


thelist-bounces at lists.evolt.org wrote:
> Hi list,
> 
> While I'm still new to PHP, what is the procedure for
> removing bounced emails sent by PHP in a mySQL database?
> 
> I did a guick Google and didn't find much.
> 
> Rob.Smith

Given a comma-delimited string of email addresses that bounced, here's a
function I just wrote that should do it for you (I haven't tested it yet
so I can't guarantee that it works):

function rmv_emails($emails) {
	// Change these values to work with your database.
	$host = 'localhost';
	$username = 'root';	// Don't ever login as root from one of
your pages!
	$password = 'sex';	// Don't ever use this password!
	$db = 'my_website';
	$table = 'subscribers';

	// Connect to server and select the db
	mysql_connect($host, $username, $password);
	mysql_select_db($db);

	$emails = explode(',', $emails);

	foreach ($emails as $email)
		mysql_query('DELETE FROM ' . $table . ' WHERE email="' .
$email . '"');

	mysql_close();
}

It doesn't have any error-checking built-in, but that's the best I can
do in five minutes, and you should be able to figure it out from here.

HTH,
David

--
    David I. Bindel
  Website Development
 dbindel at austin.rr.com
  www.davidbindel.com



More information about the thelist mailing list