私は私の電子メールに情報を送信するためにお問い合わせフォームを作った、と私はフォームを送信するたびに、私は私のPHPファイル(mywebsite.com/contact.php)にリダイレクトし、内部サーバーエラー(500種類)を示しています。私は何を間違えたのですか?私は別のファイルに私のHTMLとPHPコードがあるので、それはできますか?私は私のコンタクトフォームも含めて、関連性がある場合に備えました。なぜ私の連絡先フォームは、作業phpmailerのを使用していませんか?
<?php
if(isset($_POST['submit']))
{
$message=
'Full Name: '.$_POST['name'].'<br/>
Comments: '.$_POST['comments'].'<br/>
Email: '.$_POST['email'].'
';
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.mail.yahoo.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'letmejusteditthisout'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom($_POST['email'], $_POST['name']);
$mail->addReplyTo($_POST['email'], $_POST['name']);
$mail->addAddress('[email protected]'); // Add a recipient
$result = $mail->Send();
$message = $result ? 'Successfully sent!' : 'Sending Failed!';
unset($mail);
$mail->Subject = "New Form Submission";
$mail->MsgHTML($message);
?>
<!-- Container (Contact Section) -->
<form action="newcontact.php" method="POST" name='contactform' id='contactform' enctype="text/plain">
<div id="contact" class="container-fluid bg-grey">
<h2 class="text-center">CONTACT</h2>
<div class="row">
<div class="col-sm-5">
<p>Contact us and we'll get back to you within 24 hours. </p>
<p><span class="glyphicon glyphicon-map-marker"></span> Burlington, ON</p>
<p><span class="glyphicon glyphicon-phone"></span> 289-230-4510</p>
<p><span class="glyphicon glyphicon-envelope"></span> [email protected]</p>
</div>
<div class="col-sm-7 slideanim">
<div class="row">
<div class="col-sm-6 form-group">
<input class="form-control" id="name" name="name" placeholder="Name" type="text" required>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="email" name="email" placeholder="Email" type="email" required>
</div>
</div>
<textarea class="form-control" id="comments" name="comments" placeholder="Comment (not required)" rows="3"></textarea><br>
<div class="row">
<div class="col-sm-12 form-group">
<input type="submit" name="submit" value="Submit" />
</div>
</div>
</div>
</div>
あなたのWebサーバのエラーログには何が役に立つことを願っていますか?あなたの 'if'文を閉じるようなことはありません。 –