未收到来自我的php表单的电子邮件

未收到来自我的php表单的电子邮件,php,forms,Php,Forms,我有一个html表单和一个php处理程序,但我没有收到表单应该发送的电子邮件。我到处找了好几个小时,都找不出来。我刚刚开始使用php,非常感谢您的帮助,谢谢。这是我的密码。出于安全原因,我更改了电子邮件地址 <form action="formHandler.php" method="post"> <div class="forForm first"> <label for="namename" class="contactLabel">

我有一个html表单和一个php处理程序,但我没有收到表单应该发送的电子邮件。我到处找了好几个小时,都找不出来。我刚刚开始使用php,非常感谢您的帮助,谢谢。这是我的密码。出于安全原因,我更改了电子邮件地址

<form action="formHandler.php" method="post">
      <div class="forForm first">
      <label for="namename" class="contactLabel">Name</label><br /><input placeholder="Name" class="editable" type="text" name="namename" id="namename"/>
      </div>
      <div class="forForm second">
      <label for="emailemail" class="contactLabel">Email</label><br /><input placeholder="Email" class="editable" type="email" name="emailemail" id="emailemail" required/>
      </div>
      <div id="surname">
      <label for="surnamesurname" class="contactLabel">Surname</label><br /><input type="text" value="Smith" class="editable" name="surnamesurname" id="surnamesurname" />
      </div>
      <div>
      <input id="submitBTN" type="submit"/>
      </div>
      </form>

名称
电子邮件
姓氏
和formHandler.php

<?php    
$surname = $_REQUEST['surnamesurname'];
    if($surname != "Smith") {
    echo "We encountered a problem, please try again later1.";
    }else{
    $myemail = 'email@email.com';
    $name = $_REQUEST['namename'];
    $email = $_REQUEST['emailemail'];
    $from = "oneandone.net";
    $to = "contactform@domain.co.uk";
    $subject = "New sign up!";
    $body = "Someone new has signed up: \n Name: $name \n Email: $email";
    $headers = "From: $from";
    $result = "mail($to,$subject,$body,$headers)";
    if(!$result){echo "your message was not sent";}
}
?>


谢谢

您不是在发送电子邮件,而是在定义字符串

改变

$result = "mail($to,$subject,$body,$headers)";


你可能会更幸运

谢谢你,这个问题解决得很好,我会确保我不会再犯那个容易犯的错误,很高兴它帮了我的忙!
$result = mail($to,$subject,$body,$headers);