Iıve defined $to earlier on only thing is it still doesnıt work correctly with the mail() function inside the while loop. The reason I wanted it in here was Iım using the personıs first name in the body of the mail.
Should I just populate an array with the details of the users (first_name, email_address) in the while loop, and then use this to send the mail? This would just produce the same result though? Is there something like MoveNext I should use for the mail function? If I put the $headers in the while loop it just keeps adding to the $headers instead of sending each mail separately as I want it to. Thanks for the help Enda -- 9/5/03 1:15 PM, "Jay Blanchard" <[EMAIL PROTECTED]> wrote: > [snip] > while($row = mysql_fetch_array($result1)) > { > $headers .= "MIME-Version: 1.0\r\n"; > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; > $headers .= "From: Website <emailaddress>\r\n"; > $headers .= "To: $row[email_address]\r\n"; > $headers .= "X-Priority: 1\r\n"; > $headers .= "X-MSMail-Priority: Normal\r\n"; > $headers .= "X-Mailer: MyWebsite"; > $subject = "$subject"; > $message = "<html><head><title>aaa</title></head><body > bgcolor=ffffff>aaa</body></html>"; > > mail($to, $subject, $message, $headers) > or print "Could not send mail to customer"; > > print "<br><font size=1><font color=cccccc>mail sent to > </font><b>$row[email_address]</b>"; > } > [/snip] > > At first glance .... $to is undefined. When testing set > error_reporting(E_ALL); to catch these kinds of things. Is it possible > that you define $to as your e-mail address somewhere else and each time > the thing loops it sends you a copy? > > > Have a pleasant, productive and prosperous day. - + - + - + - + - + - + - + - + - + - + - + - + - Enda Nagle +353 86 168 0774 [EMAIL PROTECTED] www.nightsol.net - + - + - + - + - + - + - + - + - + - + - + - + -