-2

my code save info in database but doesn't send the message to email and the alert message not work. can you help me , please ?

`

if(isset($_POST['send'])){
    $to = "nada_26_@hotmail.com"; // this is your Email address
    $subject = "Form contact";
    $subject2 = "Copy of your form submission";
    $name = $_POST['name'];
    $from = $_POST['email'];
    $subject3 = $_POST['subject'];
    $company = $_POST['company'];
    $content = $_POST['message'];
    $message = "Name: ".$name ." Subject: " . $subject3 . " Company: " . $company ."\n\n".$content;
    $message2 = "Here is a copy of your message " . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers); //send the message to the admin
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender


    $sql ="INSERT INTO threadnn_arab.contactus VALUES('$name','$from','$subject3','$company','$message','')";
    $result=mysql_query($sql); 
             echo "<script> alert('Mail Sent, Thank you, we will contact you shortly.'); </script>";


                  header('Location: index.php?#contact');           
                }
?>  `
Haya
  • 1
  • 3

1 Answers1

0

i think it on your email provider, smtp may be.or you can using PHPMailer look like in this question Send email from Hotmail using php

Community
  • 1
  • 1
cakpep
  • 87
  • 6