我如何通过php发送电子邮件到我的收件箱联系我们页面html [复制]

This question already has an answer here:

This is php code:

    <form action="form.php" method="post" enctype="multipart/form-data">

        <h1 class="title">Contact</h1>

        <label></label>
        <input name="name" required="required" placeholder="Your Name">


        <label></label>
        <input name="email" type="email" required="required" placeholder="Your Email">


        <label></label>
        <textarea name="message" cols="20" rows="5" required="required" placeholder="Message"></textarea>


        <input id="cancel" name="cancel" value="Cancel" />

        <input id="submit" name="submit" type="submit" value="Submit">

    </form>

This is php code :

I have to set my email address but I cant receive the message. where is my coding wrong.

https://i.gyazo.com/c79a14dd8023b6a2f2ba4bddc85d19f9.png

</div>

In from of Mail Function you need to set also e-mail address of sender not only the Name.

$headers = 'From: Jack Sparrow <jsparrow@blackpearl.com>' . PHP_EOL .
    'Reply-To: Jack Sparrow <jsparrow@blackpearl.com>' . PHP_EOL .
    'X-Mailer: PHP/' . phpversion();
mail($to,$subject,$message,$headers);