Newsletter Script
| From: | Sascha Braun | Date: | Wed, 25 Sep 2002 08:47:52 +0000 |
| Subject: | Newsletter Script | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-117533@lists.php.net to get a copy of this message | ||
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