mail() not going to my inbox
Posted: Tue Jul 04, 2006 9:02 pm
I know there was recently a similar thread posted - but instead of me hijacking his thread I have decided to start a new one. Keep in mind my problem is not the same either.
Ok, so I have a faily simple feedback form set up. This form takes the user's name, email, and message - and then sends them all to a specified email address. As far as I know, the code is fine - it's just that nothing is being sent to my inbox, and I am wondering if that has to do with the server I am hosted on... or if that my code is actually wrong.
Here is the form:
here is "processfeedback.php"
In addition to the problem of the mail not being sent - I have another question regarding the error handling behind forms. On any reputable website with a form - if you miss a required value, and click submit... the site will point you back to the form. I am wondering how I can get this same functionality in my mail() script. Could someone enlighten me to the best way of getting that sort of thing done?
Ok, so I have a faily simple feedback form set up. This form takes the user's name, email, and message - and then sends them all to a specified email address. As far as I know, the code is fine - it's just that nothing is being sent to my inbox, and I am wondering if that has to do with the server I am hosted on... or if that my code is actually wrong.
Here is the form:
Code: Select all
<html>
<head>
<title>Feedback</title>
</head>
<body>
<h1>Feedback</h1>
<p>Please tell us what you think.</p>
<form method=post action="processfeedback.php">
Your name: <br />
<input type=text name="name" size=40><br />
Your email address: <br />
<input type=text name="email" size=40><br />
Your feedback:<br />
<textarea name="feedback" rows=5 cols=30>
</textarea><br />
<input type=submit value="Send feedback">
</form>
</body>
</html>Code: Select all
<html>
<head>
<title>Feedback Submitted</title>
</head>
<body>
<?php>
//short variable names
$name = $_POST['name'];
$email = $_POST['email'];
$feedback = $_POST['feedback'];
//mail() function variables
$toaddress = 'mabufo@gmail.com';
$subject = 'Php form test';
$mailcontent = 'Customer Name: '.$name. "\n"
.'Customer email: '.$email. "\n"
."Customer Feedback: \n".$feedback."\n";
$fromaddress = 'From: webserver@example.com';
//mails the form results
mail($toaddress, $subject, $mailcontent, $fromaddress);
?>
<h1>Feedback Submitted.</h1>
<p>Your feedback has been shipped as is:</p><br />
<?php
echo n12br($mailcontent);
?>
</body>
</html>