0

Hi I have a simple form to send email. The problem is the PHP is getting executed and echoing success. But I am not receiving any mail. What could be the problem?enter image description here

<?php 
$name = $_POST['Name'];
$email = $_POST['Email'];
$phone = $_POST['Phone'];
$subject = $_POST['Subject'];
$message = $_POST['Message'];

$to = 'test@email.com';
$subject = 'the subject';
$message = 'FROM: '.$name.'  Email: '.$email.'  Phone: '.$phone.'  Subject: '.$subject.'  Message: '.$message;
$headers = 'From: your@domain.com' . "\r\n";

if (filter_var($email, FILTER_VALIDATE_EMAIL)) { // this line checks that we     have a valid email address

ini_set('SMTP', 'relay-hosting.secureserver.net');
ini_set('smtp_port', 25);

mail($to, $subject, $message, $headers); //This method sends the mail.
echo "Your request has been recieved. We will be contacting you shortly!"; // success message
}else{
echo "Invalid Email!";
}
 ?>
Tony Stark
  • 93
  • 1
  • 2
  • 11

0 Answers0