Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi, I have written a contact form which doesn't seem to send any email. However, I have tested the mail function and it returns true, so why am I not getting an email!? For the purpose of testing, I have stripped it down and made it as simple as possible and still I get no email. Does anybody know what the reason for this may be? I have tested it with 3 different email addresses. This is so typical. Always happens to meCode: Select all
<?php
$errmsg = "";
$name = "";
$email = "";
$subject = "";
$message = "";
if(isset($_POST["send"])) {
$name = $_POST["name"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$to = "example@site.com";
mail($to, $subject, $message);
} else {
?>
<table width="100%" style="margin-top:20px;">
<form id="contactform" name="contactForm" method="post">
<tr height="25px">
<td width="70px" align="right" ><h2 class="contactTitle">Name: </h2></td>
<td><input type="text" id="name" name="name" size="40" class="contactField" value="<?=$name;?>"></td>
</tr>
<tr height="25px">
<td align="right"><h2 class="contactTitle">Email: </h2></td>
<td><input type="text" id="email" name="email" size="40" class="contactField" value="<?=$email;?>"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr height="35px">
<td align="right"><h2 class="contactTitle">Subject: </h2></td>
<td><input type="text" id="subject" name="subject" size="40" class="contactField" value="<?=$subject;?>"></td>
</tr>
<tr>
<td valign="top" align="right"><h2 class="contactTitle">Message: </h2></td>
<td><textarea rows="10" id="message" name="message" cols="60" class="contactField"><?=$message;?></textarea></td>
</tr>
<tr height="35px">
<td> </td>
<td><input type="submit" id="send" name="send" value="Send Message"></td>
</tr>
</form>
</table>
<?php
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]