|  | Posted by Rik on 02/12/07 11:19 
On Mon, 12 Feb 2007 12:08:45 +0100, trashed <ahhhno@.com> wrote:
 > I have a guestbook which has a field that basically asks "join mailing=
 
 > list?". Can someone please point me to a code snippet somewhere that c=
 an
 > help me figure out where to start on this? My database (MySQL) already=
 
 > collects all the user's contact info and the 'yes or no' response for =
 the
 > mailing list question so I'm hoping this is not incredibly difficult t=
 o  =
 
 > do.
 > I have a contact form on my site so maybe I can copy/paste that code f=
 or  =
 
 > the
 > actual mass mailing function?
 >
 > thanks!
 
 $result =3D mysql_query('SELECT `mail` FROM `table` WHERE `mailinglist` =
 =3D  =
 
 \'yes\'') or die(mysql_error());
 while($row =3D mysql_fetch_assoc($result){
 mail($row['mail'],'This is the title','And here is the text body');
 }
 
 Or possibly:
 
 $mails =3D array();
 while($row =3D mysql_fetch_assoc($result) $mails[] =3D $row['mail'];
 mail('you_own_emailadress@example.com','Title','Text','Bcc:  =
 
 '.implode(',',$mails));
 -- =
 
 Rik Wasmus
  Navigation: [Reply to this message] |