Help with the mail() function
Posted: Thu Jan 20, 2005 8:29 pm
I am creating a simple form where you just type your email address and a message and then it sends it to me. Its just a simple test for a bigger mailing list thing i will be making.
Here is my html code
Thats my html and form, here is my php file code...
I don't understand why when i try it out i get an email from nobody and the subject is : From email, and the body consist of message.
Thanks guys
Here is my html code
Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#333333" text="#999966" link="#FFFF00" vlink="#999933" alink="#FFFF99">
<div align="center">
<form action="mail.php" method="post" name="mail" id="mail">
<p>Your Email:</p>
<p>
<input name="from" type="text" id="from2" size="50">
</p>
<p>Message: </p>
<p>
<textarea name="message" cols="43" rows="5" id="message"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Send Mail">
</p>
</form>
<p> </p></div>
</body>
</html>Code: Select all
<?
$to = "myemail@optonline.net";
$from = "email";
$subject = "From $from";
$message = "message";
mail($to, $subject , $message);
header("location:http://www.nokidding.websiteallies.com");
?>Thanks guys