Once this form is submitted the info goes to database, but for some reason its im not getting a copy to my email which i should be, im not understanding why? what code will i need to add or modify to get a copy to my email account... <?php require_once('db.inc.php'); if (isset($_POST['sell_submit'])) { if ($_POST['biz_type'] == 'Business Type' || $_POST['email'] == 'Email Address') { echo 'Please hit the back button and fill up the 2 fields.'; exit(); } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])) { echo 'Email not valid.'; exit(); } else { $to = 'info@email.com'; $eol = "\r\n"; $subject = 'WEBSITE (Sell Business)'; $headers .= 'From: Website Business<info@email.com>'.$eol; $headers .= 'Content-Type: text/html; charset=ISO-8859-1 '.$eol; $headers .= 'MIME-Version: 1.0 '.$eol; $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $body = 'Someone had submitted the form at sell-submit.php and here\'s the informations,<br>'; $body .= 'Email: '.$_POST['email'].'<br>'; $body .= 'Business Type: '.$_POST['biz_type'].'<br>'; $body .= 'Warm Regards,<br><br>'; $body .= 'WEBSITE<br>'; $body .= 'www.website.com<br>'; $body .= 'www.website.com'; mail($to, $subject, $body, $headers); } ?> PHP:
try using the following code: $ok = @mail($to, $subject, $body, $headers); if(! $ok) { die("Sorry but the email could not be sent. Please go back and try again!"); }
I've tried times to get the mail() function to work consistently. It is not going to happen. You should utilize PEAR Mail Package. If you are using a shared hosting plan, you may find that the mail() function is disabled to prevent spamming.