php email problem getting email address from mysql

php email problem getting email address from mysql

Here is the email i see sitting on my hosting server. as you can see the to: field is blank and not getting the emails from mysql database.

Return-path: <>
Envelope-to: [email protected]
Delivery-date: Wed, 14 Jul 2010 15:47:32 -0500
Received: from mailnull by chevette.websitewelcome.com with local (Exim 4.69)
id 1OZ8rc-0000WU-IV
for [email protected]; Wed, 14 Jul 2010 15:47:32 -0500
Auto-Submitted: auto-replied
From: Mail Delivery System <[email protected]>
To: [email protected]
Subject: Mail failure - no recipient addresses
Message-Id: <[email protected]>
Date: Wed, 14 Jul 2010 15:47:32 -0500
A message that you sent contained no recipient addresses, and therefore no
delivery could be attempted.
------ This is a copy of your message, including all the headers. ------
To:
Subject: test

The user signs up and thier email_address & name get stored in the [font=courier new]games_newsletter table.[/font]

[font=courier new]here is the php code that sends the emails out.[/font]

[php]

<? require_once("../conn.php"); require_once("../includes.php"); require_once("access.php"); require_once("AdminNavigation.php"); if(isset($_POST[s1])) { $q2 = "select * from games_newsletter "; $r2 = mysql_query($q2) or die(mysql_error()); while($a2 = mysql_fetch_array($r2)) { $to = $a2[email]; $subject = $_POST[sub]; $message = $_POST[MyMessage]; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "From: $_SERVER[HTTP_HOST]$dir <$aset[ContactEmail]>\n"; $headers .= "X-Priority: 1\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "X-Mailer: PHP/" . phpversion()."\n"; mail($to, $subject, $message, $headers); $i++; } $error = "$i messages was sent"; } //get the number of registered for the newsletter $q2 = "select count(*) from games_newsletter"; $r2 = mysql_query($q2) or die(mysql_error()); $a2 = mysql_fetch_array($r2); if($a2[0] == 0) { echo "

There are no registered members, yet!"; exit(); } ?> There are <?=$a2[0]?> newsletter subscribers.
Newsletter
<?=$error?>
Subject:
Message:
&nbsp
<? require_once("admin_footer.php"); ?> [/sub][/php]

I have spent the whole day on this and it doesn’t work. I have a members email and it sends out the emails no problem and from what I could see the only diffents in the two php files were the select from * tables and that is it.

thank you in advance

Figured it out myself. all I did was change the email_address to email in the games_newsletter table and made a change to the subscription form and it all worked out. strange I have no programming or PHP experience but it goers to show sometimes just trying things can fix it.

Sponsor our Newsletter | Privacy Policy | Terms of Service