Hi i'm having trouble running the php mail() function on my hosting. I was using a script I took off another site which worked correctly, when I put it on my site it doesn't fail, but it also doesn't send emails. 1&1 tech support monkeys sent me to a FAQ article with the following script in. I duly uploaded this and filled in my email address etc. However this doesn't work. After ringing them again they keep on repeating the same solution like some kind of stuck record, no matter how many times I tell them it doesn't work! grrr!
Do you think that their PHP might not be configured correctly or am I making some kind of fundamental error?
Do you think that their PHP might not be configured correctly or am I making some kind of fundamental error?
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contact Us</title>
</head>
<body>
<form method="post" action="emailtest2.php">
<table>
<tr>
<td>What is your name ?</td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td>What is your e-mail address ?</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td> Comments:</td>
<td><textarea name="data" cols=40 rows=6></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
PHP:
<?
$to = '[email protected]';
$subject = 'subject';
$message = 'From: ' . $_REQUEST['name'] . "\n\n" . $_REQUEST['data'];
$email = $_REQUEST['email'];
$headers = 'From: ' . $email . "\r\n" .
'Reply-To: ' . $email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail ($to, $subject, $message, $headers);
?>