Hi guys, I am a complete PHP newbie - I am helping a mate design a form on his website for people to sign up for a newsletter, and when they do they get emailed a HTML 50% off voucher. I have the MySQL database, the form and the PHP working to submit the details to the SQL and that works perfectly. There are only 3 fields on the form - Name, phone and email. What I am now trying to do is send an HTML email to the email address they specify - so effectively it sends the voucher automatically. When the script is run it forwards them to a thankyou html page. I found the PHP for the HTML email on this site somewhere, and put it in my script. When I press submit on the form, it submits the data and displays the thanks page, and no email appears! The code is below - any ideas where I am going wrong? I have only been using PHP for 3 days now, and its great! I hope to get into it more! Chas [code]<? $database="web15-hairkandi"; $name=$_POST['name']; $phone=$_POST['phone']; $email=$_POST['email']; $from = "
[email protected]"; $subject = "Hello! This is HTML email"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO contacts VALUES ('','$name','$phone','$email')"; mysql_query($query); //begin message $message = <<<EOF <html> <body bgcolor="#DCEEFC"> <center> <b>TEST EMAIL</b> <br> <font color="red">DOES THIS WORK?</font> <br> <a href="http://www.google.com/">* maaking.com</a> </center> <br><br>TEST TEST <br> TEST<br>TEST </body> </html> EOF; //end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $email = "$email, $from"; // this will send to both emails at the same time. // now lets send the email. mail($email, $subject, $message, $headers); header( "Location: thanks.htm" ); mysql_close(); ?>[/code]