Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29919

Form Not Sending Email Data PHP

$
0
0

So I followed the following video to setup my email PHP form. I uploaded the form to my website to test it. I got the email in my spam inbox, but none of the data was sent (name, email, message, etc). I need help figuring out what I'm doing wrong.

HTML

<form action="mailDeveloper.php" method="POST">
            <p>Name:</p><input type="text" name="name" placeholder="John Smith" required autocomplete=""><br>
            <p>Email:</p><input type="email" name="email" placeholder="example@example.com" required autocomplete=""><br>
            <p>Subject:</p><input type="text" name="subject" placeholder="Support" required autocomplete=""><br>
            <p>Message:</p><textarea name="message" placeholder="Comments, questions, and anything else" required></textarea><br>
            <input type="submit" value="Submit">
        </form>

PHP

<?php

if(isset($_POST['submit'])) {
    $name = $_POST['name'];
    $subject = $_POST['subject'];
    $mailFrom = $_POST['email'];
    $message = $_POST['message'];
}

$mailTo = "info@lpstories.com";
$headers = "From: ".$mailFrom;
$txt = "You have received an email from ".$name.".\n\n".$message;

mail($mailTo, $subject, $txt, $headers);
header("Location: index.php?mailsend") or die("There was an error, and your email did not send!");
?>

Viewing all articles
Browse latest Browse all 29919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>