SV: [PHP-DB] Emailing a Database

From: Date: Tue, 10 Oct 2000 06:15:19 +0000
Subject: SV: [PHP-DB] Emailing a Database
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-3457@lists.php.net to get a copy of this message
Hi, Just make sure you know the limit of your mailserver. Some mailservers has a limit of max 100 recipients in one mail. Regards, Fredrik. -----Ursprungligt meddelande----- Fran: Cody Caughlan [mailto:codyc@cisco.com] Skickat: den 10 oktober 2000 03:26 Till: Peter Burgess Kopia: php-db@lists.php.net Amne: Re: [PHP-DB] Emailing a Database Basically, you just want to cycle through all the rows of your database, grab the email adress and shove it in an array. Then, implode the array with a comma as the delimiter, now a huge string containing your addresses is ready to be sent in a message. Like this: $query = "SELECT emailAddress FROM yourTable"; $res = mysql_db_query("databaseName", $query); $myArr = array(); while($row = mysql_fetch_array($res)) { $str = $row[emailAddress]; array_push($myArr, $str); } $lineOfAddresses = implode(",", $myArr); Mail($lineOfAddresses, "Your subject", "Your message"); //use a 4th arg for extra headers (reply-to, etc) Thats it. /Cody Caughlan Peter Burgess wrote: > Hi There, > > I've created a database of customers and their email addresses > in mySQL but have no idea how to email all those addresses. > Could someone point me to some tutorials or render some advice. > >From reading some resources I know that this can be achieved > via perl but can php perform this function. Any advice would be > welcomed. > > __,,_____________ > < ___________/ > / /-' > /___/ > > Peter Burgess > m2o Designs > 151 Greville Street Prahran 3181 > Melbourne Australia > Ph: 03 9521 2553 > Fx: 03 9529 4712 > EM: peter@m2o.com.au > URL:http://www.m2o.com.au > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#3457) next »