Re: NEED HELP - Mailing List

From: Date: Thu, 07 Sep 2000 04:27:37 +0000
Subject: Re: NEED HELP - Mailing List
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15660@lists.php.net to get a copy of this message
On Thu, 07 Sep 2000, Ralph Guzman wrote: > I've been breaking my head on this so I finally decided to ask for help. > > I am writting a script that will pull all email addresses in our db, then > individually send them an email using a form. Basically it's a mass mail. > Below is the code that I am working with, but it does not seem to be > working. Can anybody share some light on this one? > > // sql query looks like this: > > $primary_query = "SELECT email,firstname,lastname FROM users"; > $primary_result = mysql_query($primary_query,$link); > > // then here is my head breaker > <? > while($primary_row = mysql_fetch_array($primary_result)): > > $message_mail .= "$primary_row[firstname] $primary_row[lastname],\n\n"; > $message_mail .= "$message"; > mail("$primary_row[email]", "$subject", "$message_mail", > "From:$from_email\n\n"); > > echo "Emailed: $primary_row[email]<BR>"; > > endwhile; > ?> You haven't said what your problem is, but I can see one potential fault: you need to start each message with a blank $message_mail. You are appending subsequent messages to the first one. -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#15660) next »