I've looked everywhere on the web and I can't find a solution to my mail function. I've used xampp localhost and ive uploaded to a domain with no results.
My PHP code is:
<?php
//Grab from html form
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$error = "";
//check if fields are filled
if (empty($subject)) {
$error = "Enter a subject";
}
if (empty($message)) {
$error .= "Enter a message";
}
echo $error;
//send email
mail($email, $subject, $message);
?>
The html code is below just in case...
<!DOCTYPE HTML>
<html>
<head>
<meta charset= "utf-8">
</head>
<body>
<form action="serverCode/mail.php" method="post">
Subject: <input type="text" name="subject"><br>
From: <input type="text" name="from"><br>
From Email: <input type="text" name="fromEmail"><br>
Message: <input type="text" name="message"><br>
To Email: <input type="text" name="email"
<input type="submit" value="Submit">
</form>
</body>
</html>
I'm just trying to make a simple webmailer in PHP.