PHP Form isnt emailing me
| From: | Austin C | Date: | Sat, 09 Jun 2007 01:48:21 +0000 |
| Subject: | PHP Form isnt emailing me | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-256426@lists.php.net to get a copy of this message | ||
Hello, I just finished making a PHP contact form for my webite, and I can
run through the whole thing, and get no errors, but it doesnt email me the
form contents.
*Here is th actual form page:*
<?php include("../header.php"); ?>
<td bgcolor="#BFC4CB"><b><font color="#333333">ContactMe</font></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#BFC4CB">
<p>
<font color="#333333">
Please use this form to contact me:
<p>
<br><center><form action="processcontactform.php" method="post">
Name: <input type="text" name="name" size="20">
<br>Email Address/Method of Contact: <input type="text" name="contact"
size="30">
<br>Reason for Contact: <select name="reasonforcontact">
<option value="question">Question</option>
<option value="suggestion">Suggestion</option>
<option value="gcomment">General Comment</option>
<option value="fanmail">Fan Mail</option>
<option value="other">Other</option>
</select>
<br>Message: <br><textarea name="message1" rows="10" cols="30"></textarea>
<br><input type="submit" value="send">
</form></center>
<?php include("../footer.php"); ?>
*Here is the form page processor:*
<?php include("../header.php"); ?>
<td bgcolor="#BFC4CB">
<b>
<font color="#333333">Processing your information . . .</font></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#BFC4CB">
<p>
<font color="#333333">
<?php
$name = $_POST['name'];
$email = $_POST['contact'];
$reason = $_POST['reasonforcontact'];
$message = $_POST['message1'];
$to = "webmaster@galacticwebdesigns.com";
$subject = "Contact Form Submitted at GWD-Dev";
$body = "Hello Austin,
".$name." has sent in a contact form at GWD-Dev. The reason he/she
contacted you was for ".$reason.". Here is the message they submitted with
their form:
".$message."
The contact field of the form contained the following information:
".$email."
Please remember to get back to them ASAP!!";
$headers = "From: ".$name." <".$email.">\n";
echo "Collecting information . . . . . . . . . . DONE!<p>";
$mail_sent = @mail($to, $subject, $body, $headers);
echo $mail_sent ? "<br>Sending contact form to webmaster . . . . . . . .
DONE!<p>" : "<script>alert('The mail did not go through')</script>";
echo "<br>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . .<p>";
echo "<br>Thank you for contacting us, please expect a reply in anywhere
from 1 to 24 hours. Make sure that our email address, galacticneo@gmail.com&
webmaster@galacticwebdesigns.com, are not sent to your spam folder.";
include("../footer.php"); ?>
--
Thanks, the webmaster of Galacticneo