웹 사이트에 연락 양식이 있습니다. 제출물을 클릭 할 때마다 제출 되었음에도 불구하고 내 전자 메일 주소로 아무 것도받지 못합니다.PHP 제출 양식을 제출했지만 수신하지 않음
<div id="contactform">
<form name="contact" method="post" action="PHP/send_form_email.php">
<ol>
<li><label>To </label>
<select name="emailaddress" id="emailaddress">
<option value="0"></option>
<option value="1">General Queries</option>
<option value="2">Webmaster Queries</option>
</select>
</li>
<li><label for="name">Name</label>
<input type="text" name="name" id="name"></input>
</li>
<li><label for="email">Email</label>
<input type="text" name="email" id="email"></input>
</li>
<li><label for="subject">Subject</label>
<input type="text" name="subject" id="subject"></input>
</li>
<li><label for="message">Message</label>
<textarea name="message" id="message" cols="45" rows="5"></textarea>
</li>
<li>
<input name="submit" type="submit" class="submit" id="submit" value="submit"></input>
</li>
</ol>
</form>
</div>
을 다음과 PHP는 분명히 내가 이메일 1과 EMAIL2되지 사용한 전자 메일 주소
<?php
if(isset($_POST['email'])) {
$subject = $_REQUEST['subject'];
$emailaddress[1] = "[email protected]";
$emailaddress[2] = "[email protected]";
$contactnameindex = $_REQUEST['emailaddress'];
if ($contactnameindex == 0 || !isset($_REQUEST['emailaddress']))
die ("You did not choose a recipient. Please hit your browser back button and try again.");
else
$emailaddress = $emailaddress[$contactnameindex];
function died($error) {
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if (!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['subject']) ||
!isset($_POST['message'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$email = $_POST['email']; // required
$subject = $_POST['subject']; // required
$message = $_POST['message']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
if(strlen($message) < 2) {
$error_message .= 'The Message you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "name: ".clean_string($name)."\n";
$email_message .= "email: ".clean_string($email)."\n";
$email_message .= "subject: ".clean_string($subject)."\n";
$email_message .= "message: ".clean_string($message)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
Thank you for contacting us. We will be in touch with you very soon.
<?php
}
?>
같이
html로는,하지만 난 실제 주소 I를 확인했다 사용하고 그들은 둘 다 정확하게 타자를 댈 수 있는가?
당신이 확인해보십시오나요'인 print_r ($ _POST),'가치인가? – Peon
메일을 보내는'if (mail()) '를 사용하여 확인하십시오. –
@mail로 메일 오류가 발생하는 것은 나쁜 것입니다. –