You are here: Re: email all users in database help « All PHP « IT news, forums, messages
Re: email all users in database help

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация