reuber1
10-09-2007, 02:59 AM
Never touched PHP before, but it seems to be the way to get a contact form on my site.
Well, after getting the PHP file uploaded, I can enter the contact criteria and I get a basic page that says that the e-mail has been sent (which is ugly, but I'll deal with that later), but my hosted e-mail account gets nothing. I tried it with my GMail account in the PHP file, and entered data in the form, and that didn't work either. Basically, it says the message is being sent, but nothing arrives in the specified inbox.
Here's the necessary code in contact.html:
<form method="POST" action="mailer.php">
Name<br>
<input type="text" name="name" size="19"><br>
<br>
E-Mail<br>
<input type="text" name="email" size="19"><br>
<br>
Message<br>
<textarea rows="9" name="message" cols="30"></textarea>
<br>
<br>
<input type="submit" value="Submit" name="submit">
</form>
Here's the PHP file, mailer.php:
<?php
if(isset($_POST['submit'])) {
$to = "reuber1@hotmail.com";
$subject = "Website Inquiry";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "The message could not be sent.";
}
?>
FYI, the e-mail I'm actually using is the e-mail on my site, not the crappy spam maintenance Hotmail account I have.
Any ideas why this isn't working? I'm stumped.
Well, after getting the PHP file uploaded, I can enter the contact criteria and I get a basic page that says that the e-mail has been sent (which is ugly, but I'll deal with that later), but my hosted e-mail account gets nothing. I tried it with my GMail account in the PHP file, and entered data in the form, and that didn't work either. Basically, it says the message is being sent, but nothing arrives in the specified inbox.
Here's the necessary code in contact.html:
<form method="POST" action="mailer.php">
Name<br>
<input type="text" name="name" size="19"><br>
<br>
E-Mail<br>
<input type="text" name="email" size="19"><br>
<br>
Message<br>
<textarea rows="9" name="message" cols="30"></textarea>
<br>
<br>
<input type="submit" value="Submit" name="submit">
</form>
Here's the PHP file, mailer.php:
<?php
if(isset($_POST['submit'])) {
$to = "reuber1@hotmail.com";
$subject = "Website Inquiry";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "The message could not be sent.";
}
?>
FYI, the e-mail I'm actually using is the e-mail on my site, not the crappy spam maintenance Hotmail account I have.
Any ideas why this isn't working? I'm stumped.