On Mon, 7 Mar 2005 08:37:52 +0530, Zareef Ahmed <zareef.ahmed@xxxxxxxxx> wrote: > Hi Robert, > > Please take a look at php manual and try to know something about > $_POST, $_GET etc. > Your code is full of errors. > > > On Sun, 6 Mar 2005 15:33:30 -0500, Robert <sigler@xxxxxxx> wrote: > > $sendto = "$row[1]"; > > echo "<br>Row one output = $sendto<br>"; > > mail ($_POST['sendto'],'Testing', $body, $headers); > Again you are sending the mail to same person very time. no, that part is correct. while ($row = mysql_fetch_array ($result, MYSQL_NUM)) { ... mail ($_POST['sendto'],'Testing', $body, $headers); echo "Sent to $row[1]<br>";} // <--* mysql_free_result ($result); * the values are retrieved and used in the loop, the mail IS going to the right person. > > $headers = "MIME-Version: 1.0\r\n"; > > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; > > $headers .= "From: "; > From is not set, value is not here. this is the part that's causing the problem. u can leave it empty and let the system put the admin's email id. don't leave it incomplete though. i agree that there are logical errors regarding the data he's used, but that's not why it didn't work. @Robert: u may want to print/echo all the vars for mail() before using it, helps to debug. check all $POST vars too. this is how i generally set the headers: $headers = "From: $fname <$from_email>\n"."Return-Path: $ret"."\n"; i use return path so that bounce messages/delivery failures go to another id. if u want to add the X-Mailer header: $headers.= 'X-Mailer: PHP/' . phpversion()."\n"; (note ^^^ the dot) if still doesn't work, replace ur \r\n with \n. check manual page for details. considering that u're possibly mass mailing... http://us2.php.net/manual/en/function.mail.php [quote] Note: It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient. For the sending of large amounts of email, see the PEAR::Mail, and PEAR::Mail_Queue packages. [/quote] u could also open a pipe to the mail program... http://www.devarticles.com/c/a/PHP/Getting-Intimate-With-PHPs-Mail-Function/2/ hth -- ]# Anirudh Dutt ...pilot of the storm who leaves no trace like thoughts inside a dream -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php