I have a php script to send email with data taken form a HTML form. The email does not send and the both sets of code are executed within the if statement :
Not sure if I am missing a EOL closure as new to php. Any input appreciated.
<?php
if(!$_POST) exit;
$to = 'myemail.com';
$name = $_POST['txtname'];
$email = $_POST['txtemail'];
$subject = 'Support';
$comment = $_POST['txtmessage'];
if(get_magic_quotes_gpc()) { $comment = stripslashes($comment); }
$e_subject = 'You\'ve been contacted by ' . $name . '.';
$msg = "You have been contacted by $name with regards to $subject.\r\n\n";
$msg .= "$comment\r\n\n";
$msg .= "You can contact $name via email, $email.\r\n\n";
$msg .= "-------------------------------------------------------------------------------------------\r\n";
if(@mail($to, $e_subject, $msg, "From: $email\r\nReturn-Path: $email\r\n"))
{
// THiS CODE EXECUTES
echo "<div class='dt-sc-success-box aligncenter'> <span></span> <h4> Success </h4> Thanks for <b>Contacting Us</b>, We will call back to you soon.</div>";
}
else
{
// THIS CODE EXCUTES
echo '<div class="dt-sc-error-box aligncenter"> <span></span> <h4> Error </h4> Sorry your message <b>not sent</b>, Try again Later. </div>';
}
?>