Re: Newsletter Script
| From: | Henry | Date: | Wed, 25 Sep 2002 10:21:19 +0000 |
| Subject: | Re: Newsletter Script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117543@lists.php.net to get a copy of this message | ||
Shouldn't you have some selection criteria after
$MailQuery = "SELECT * FROM newsletter_db";
such as WHERE
newsletterID=$_REQUEST['id'];
??
Other than that if its not dying and you actuall do have more than one
recipient I cannot see it.
Henry
"Sascha Braun" <saschabraun@gmx.de> wrote in message
news:001901c26470$3c6fcd70$0a7652d9@squitta...
Hi,
I wanted to write an Newsletter script. So I created two tables in my
Database. One is storing the Newsletters and one is Storing the bunch of
folks who want to have them.
Everything works fine, I can write the Newsletter very easy in my
selfwritten admin tool, but when I send the Newsletter
only the first person in the list it getting this awfull Newsletter.
Here is the script which sends out the Newsletter:
if ($_REQUEST['action'] == 'send') {
$Query = "SELECT * FROM newsletters_db WHERE id =
'".$_REQUEST['id']."'";
$Result = mysql_query($Query, $connect);
$arrResult = mysql_fetch_array($Result, MYSQL_ASSOC);
$MailQuery = "SELECT * FROM newsletter_db";
$MailResult = mysql_query($MailQuery, $connect);
$subject = $arrResult['head'];
$message = $arrResult['text'];
while ($arrMailResult = mysql_fetch_array($MailResult, MYSQL_ASSOC)) {
mail($arrMailResult['address'], $subject, $message,
"From: webmaster@$SERVER_NAME\r\n"
."Reply-To: info@$SERVER_NAME\r\n"
."X-Mailer: PHP/" . phpversion()) or die(mysql_error());
}
echo '<p class="text01">Newsletter erfolgreich verschickt.</p>';
}
Would be nice if i could get a hint =O)
Sascha