
Hi Devs, I have this script and for the life of me I cant tell where the problem is. It is submitting successfully but the mail is not being sent. As in the $to does not get the email. Could it be a problem with the hosting? <?php session_start(); $uname = "1234"; $email = "test@test.test"; $phone = "1234"; $query = "How to 123"; $message = "Name: " . $uname . "\n\n" . "Phone Number: " . $phone . "\n\n" . "Email Address: " . $email . "\n\n" . "Query: " . $query; function redirect($msg, $page) { $_SESSION['msg'] = $msg; header("Location: $page"); exit(); } //$message = $uname . \n\n . $phone . $to = "mail2lawi@gmail.com"; $receiver = "My Test Site"; $subject = "Contact Us Form"; $headers .= "From:" . $email . "\r\n"; $headers .= "X-Mailer: Unknown"; if(mail($to, $subject, $message, $headers)) { //print "success, mail successfully sent to $to"; $msg = "Mail sent to $receiver"; $page = $_SERVER['HTTP_REFERER']; $_SESSION['status'] = $msg; redirect($msg, $page); } else { //print "failure, mail failed to be sent to $to"; $msg = "Mail not sent to $receiver"; $page = $_SERVER['HTTP_REFERER']; redirect($msg, $page); } ?>