Page 1 of 1

form mail

Posted: Fri Feb 18, 2005 8:15 pm
by <t>
I can't seem to figure out whats wrong with the following script. It keeps telling me "email didnt send", but I can figure out why(no actual errors produced by php). Any ideas would be appreciated



Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<title>Form Test</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
</head> 

<body> 
<form action="Form1.php?post=yes" method="post"> 
<p>Your name: 
   <input type="text" name="name" /> 
</p> 
<p>Your email: 
   <input type="text" name="email" /> 
</p> 
<p>Message:    
   <textarea name="message" id="message"></textarea> 
<input type="submit" />
</form>
<?php 


if ($_GET&#1111;'post'] == 'yes') &#123; 

    $to = "jts3793@hotmail.com";   
    $headers  = "MIME-Version: 1.0\r\n";   
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";   
    $headers .= "From: ".$_POST&#1111;'email']."\r\n";   
    $mail = mail($to, $_POST&#1111;'name'], $_POST&#1111;'message'], $headers);
	 

    if ($mail) &#123; 
        echo "Thank you, we will get back to you as soon as possible <br /> You sent the following information <br />" . $_POST&#1111;'name'] . "<br /> " . $_POST&#1111;'email'] . "<br />" . $_POST&#1111;'name'] . "<br />";  
        echo "<a href="Form1.php?post=no">Display the form</a>";  
        exit; 
    &#125;
		else &#123; 
        echo 'email didnt send'; 
    &#125; 
&#125; 
?>  
</body> 
</html>

Posted: Fri Feb 18, 2005 8:59 pm
by feyd
maybe your mail function needs some configuration? Check the error logs to see if something did happen, but wasn't shown. May want to walk through the mail() configuration stuff on php.net as well.

Posted: Fri Feb 18, 2005 9:00 pm
by neophyte
Hmm may be a server issue. I tested it on my server and it seemed to work fine:

Output:
Thank you, we will get back to you as soon as possible
You sent the following information
asdf
gasdfff@asfffs.com
asdf
Display the form
I know the mail function depends on sendmail being available on your server if you are on a windows machine you may not find this function useful.

http://us3.php.net/manual/en/ref.mail.php

Sorry if I spammed you. LOL :wink: