템플릿을 사용하여 내 웹 사이트를 만들었습니다.이 템플릿은 연락처 페이지와 양식이 모두 제공되었지만 PHP 연락처 스크립트가 없으므로 작성하고 설정했습니다 html 양식에 대한 조치로 여전히 내 이메일에 아무 것도 보내지 않을 것입니다 ... Gmail을 통해 설정 한 메일 (도메인 메일 교환 DNS를 Gmail 설정으로 변경 함) html 문의 양식에 있습니다. 다음 코드를HTML 형식의 PHP 스크립트가 메일을 보내지 않음
<?php
$to = '[email protected]';
$to .= '[email protected]';
// Assigning data from the $_POST array to variables
$name = $_post['sender_name'];
$email = $_post['sender_email'];
$subject = $_post['sender_subject'];
$text = $_post['sender_text'];
// Construct email subject
$content = 'www.jamesreborne.co.uk Message from visitor ' . $name;
// Construct email body
$body_message = 'From: ' . $name . "\r\n";
$body_message .= 'E-mail: ' . $email. "\r\n";
$body_message .= 'Subject: ' . $subject . "\r\n";
$body_message .= 'Message: ' . $text;
// Construct email headers
$headers = 'From: ' . $email . "\r\n";
$headers .= 'Reply-To: ' . $email . "\r\n";
mail($to, $content, $body_message, $headers);
$mail_sent = mail($to, $content, $body_message, $headers);
if ($mail_sent == true){ ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'contact.html';
</script>
<?php }
else { ?>
<script language="javascript" type="text/javascript">
alert('Message not sent. Please, notify the site administrator [email protected]');
window.location = 'contact.html';
</script>
<?php
}
?>
:
<div id="contact_form"><form method="post" name="contact" action="contact-form-handler.php">
<label for="name">Name:</label> <input type="text" id="name" name="name" class="required input_field" /><div class="cleaner h10"></div>
<label for="email">Email:</label> <input type="text" id="email" name="email" class="validate-email required input_field" /><div class="cleaner h10"></div>
<label for="subject">Subject:</label> <input type="text" name="subject" id="subject" class="input_field" /><div class="cleaner h10"></div>
<label for="text">Message:</label> <textarea id="text" name="text" rows="0" cols="0" class="required"></textarea><div class="cleaner h10"></div>
<input type="submit" value="Send" id="submit" name="submit" class="submit_btn float_l" />
<input type="reset" value="Reset" id="reset" name="reset" class="submit_btn float_r" />
</form>
과 접촉 폼 handler.php는 HTML 양식을 처리하기 위해 울부 짖는이 코드를 포함
사람이 그 좋은 것 도울 수 있다면, 감사
답장을 보내 주셔서 감사합니다 ... 이름과 이메일을 추가했지만 질문을 게시 할 때 형식이 올바르지 않습니다. 나는 $ subject = $ _post [ 'subject']도 변경했다. ~ $ subject = $ _POST [ '제목']; 또한 텍스트와 여전히 성공하지 못했습니다. 더 이상 아이디어가 없습니까? –