我创建了一个基本的html联系表单,我使用PHP发送电子邮件。但是,由于我是由Github托管的,因此我将链接到一个错误页面,其中Github说“请求是禁止的内容。抱歉。如果问题仍然存在,请尝试刷新并与我们联系。”有办法解决这个问题吗?
这是我的HTML:
<form action="contact.php" method="POST">
<div class="contactinfo">
<label>
<span>NAME:</span>
<input type="text" name="name">
</label>
<label>
<span>E-MAIL:</span>
<input type="email" name="email">
</label>
</div>
<label>
<span>MESSAGE:</span>
<textarea name="message"></textarea>
<input class="button" type="submit" value="Send">
</label>
</form>
PHP:
<?php
$email_to = "example@gmail.com";
$email_subject = "RE: Contact Me";
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$email_message .= "Name: ".clean_string($name)."\n";
$email_message .= "Message: ".clean_string($message)."\n";
$headers = 'From: '.$email."\r\n".
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>