I have this code for my website and am having an issue. The [email protected]
email works, but [email protected]
never gets the email sent to it using the email form. Help?
Contact Page Code (HTML)
Fields with a <font color="Red">*</font> Are Required
<form id="form" action="send.php">
<p class="contactformtext">
<font color="Red">*</font> Name: <input name="name" type="text" class="formname"/><br/>
<font color="Red">*</font> Email: <input name="email" type="text"/><br/>
<font color="Red">*</font> Subject: <select name="subject">
<option>Questions</option>
<option>Website Error</option>
<option>Advertising Opportunities</option>
<option>General Feedback</option>
<option>Suggestions</option>
<option>Other</option>
</select><br/>
<font color="Red">*</font> Message: <br/>
<textarea name="message" cols="75" rows="10"></textarea>
<br/>
<input class="submit" type="submit" name="sendmail" value="Submit"/>
<input class="reset" type="reset" name="sendmail" value="Reset"/>
</p>
</form>
PHP Code:
<?php
$to = "garneth@gar[email protected]
";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$headers = "From: $from";
$subject = $_REQUEST['subject'];
$fields = array();
$fields{"name"} = "Name";
$fields{"email"} = "Email";
$fields{"subject"} = "Subject";
$fields{"message"} = "Message";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: [email protected]
";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at http://www.garneth.co.cc/";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
if ( preg_match( "/[\r\n]/", $name ) || preg_match( "/[\r\n]/", $email ) )
{
header('Location: http://www.garneth.co.cc/forbidden.html');
}
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://www.garneth.co.cc/thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify [email protected]
"; }
}
}
?>

