Can't figure mail & post out
| From: | Robert | Date: | Sun, 06 Mar 2005 20:33:30 +0000 |
| Subject: | Can't figure mail & post out | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-210112@lists.php.net to get a copy of this message | ||
Hi -
I am very new to php and can't get this to work right. It keeps telling me
there is no send header. I have tried multiple variations? Any ideas? I
am simply trying to query the database and send out an email to each person
in my database.
Thanks,
Robert
$query = "SELECT first_name, email FROM offer";
$result = @mysql_query ($query);
if ($result) {
echo 'Mailing List...';
while ($row = mysql_fetch_array ($result, MYSQL_NUM)) {
$fname = "$row[0]";
$body = "<html><body>Hi
{$_POST['fname']},</body></html>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ";
$sendto = "$row[1]";
echo "<br>Row one output = $sendto<br>";
mail ($_POST['sendto'],'Testing', $body, $headers);
echo "Sent to $row[1]<br>";}
mysql_free_result ($result);