Добрый день, у меня проблемы с моим сайтом, на странице контактов, когда я заполняю детали и отправляю форму, которую он обрабатывает и отправляет полученные данные на указанный адрес электронной почты, но при загрузке страницы он показывает страницу вHTML-теги.
Это то, что показывает, когда форма отправила
и на стороне электронной почты я не получаю письмо в стиле HTML, но обычно
Это то, что получено как электронное письмо
Ниже приведен мой php-скрипт, который обрабатывает данные формы и отправляет электронное письмо
<?php
include 'inc/config.php';
$msg = "";
if(isset($_POST['submit']))
{
$name = addslashes($_POST['name']);
$email = addslashes($_POST['email']);
$subject = addslashes($_POST['subject']);
$message = addslashes($_POST['message']);
if($name != "" && $email != "" && $subject != "" && $message != "")
{
require 'inc/mailer/PHPMailerAutoload.php';
header('Content-Type: application/json');
$mail = new PHPMailer;
$mail->setFrom('no-reply@kazforextraders.com', 'Kaz Forex Traders');
$mail->addAddress($email);
$mail->addReplyTo('no-reply@kazforextraders.com', 'No Reply');
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = file_get_contents('inc/contact.php');
$mail->Body = str_replace('$name', $name, $mail->Body);
$mail->Body = str_replace('$email', $email, $mail->Body);
$mail->Body = str_replace('$subject', $subject, $mail->Body);
$mail->Body = str_replace('$message', $message, $mail->Body);
if(!$mail->send()) {
$msg = 'Something Went Wrong. Plese Try Again! <br>Mailer Error: '.$mail->ErrorInfo.'';
} else {
$msg = 'Message Sent Successfully!';
}
}
else
{
$msg = 'Please Fill out all fields!';
}
}
?>
Ниже приведен файл "inc / contact.php".Это файл (в стиле HTML), который нужно отправить, но я получаю его в виде простого текста.
<!DOCTYPE html>
<!--[if IE 8 ]><html class="no-js oldie ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]><html class="no-js oldie ie9" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html class="no-js" lang="en"> <!--<![endif]-->
<head>
<!--- basic page needs
================================================== -->
<meta charset="utf-8">
<title>Kaz Forex Traders</title>
<meta name="author" content="Eminential Designs">
<!-- mobile specific metas
================================================== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- CSS
================================================== -->
<link rel="stylesheet" href="https://www.kazforextraders.com/css/base.css">
<link rel="stylesheet" href="https://www.kazforextraders.com/css/vendor.css">
<link rel="stylesheet" href="https://www.kazforextraders.com/css/main.css">
<!-- script
================================================== -->
<script src="https://www.kazforextraders.com/js/modernizr.js"></script>
<script src="https://www.kazforextraders.com/js/pace.min.js"></script>
<style>
.section-intro .with-bottom-line::after {
display: block;
background-color: white;
width: 120px;
height: 3px;
content: '\0020';
position: absolute;
left: 50%;
bottom: 0;
margin-left: -60px;
}
.section-intro .with-bottom-line:hover::after {
display: block;
background-color: white;
width: 150px;
height: 3px;
content: '\0020';
position: absolute;
left: 50%;
bottom: 0;
margin-left: -70px;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all .5s ease-in-out;
-ms-transition: all .5s ease-in-out;
-o-transition: all .5s ease-in-out;
transition: all .5s ease-in-out;
}
</style>
<!-- favicons
================================================== -->
<link rel="icon" type="image/png" href="https://www.kazforextraders.com/favicon.png">
</head>
<body id="top">
<!-- main content wrap
================================================== -->
<div id="main-content-wrap">
<!-- main content wrap
================================================== -->
<section id="intro">
<!-- <div class="shadow-overlay"></div> -->
<div class="row intro-content">
<div class="col-twelve">
<h3 class="animate-intro" id="message"></h3>
<div class="col-1-4 tab-full mob-full">
<p></p>
</div>
<div class="col-1-2 tab-full mob-full" style="padding-bottom: 13.5rem">
<img src="https://www.kazforextraders.com/images/logo.png" alt="" class="animate-intro" style="max-width: 250px;">
</div>
</div> <!-- /twelve -->
</div> <!-- /row -->
</section> <!-- /intro -->
<section id="about">
<div class="row section-intro group animate-this">
<div class="col-twelve with-bottom-line">
<h2 class="">New Message</h2>
</div>
<p class="lead" style="text-align: left;">From: $name<br></p>
<p class="lead" style="text-align: left">Email: $email</p>
<p class="lead" style="text-align: left">Subject: $subject</p>
<p class="lead" style="text-align: left">Message: $message</p>
<p class="lead" style="text-align: left">This is an automated message, do not reply to it.</p>
<p class="lead" style="text-align: left">Regards,<br>Kaz Forex Traders</p>
</div>
</section>
</div> <!-- /main-content-wrap -->
<!-- footer
================================================== -->
<footer id="main-footer">
<div class="footer-bottom" style="padding-top: 3rem ">
<div class="copyright">
<span>© Copyright Kaz Forex Traders 2018.</span>
<span>Developed by <a href="#">Eminential Designs</a></span>
</div>
</div>
</footer>
<!-- Java Script
================================================== -->
<script src="https://www.kazforextraders.com/js/jquery-2.1.3.min.js"></script>
<script src="https://www.kazforextraders.com/js/plugins.js"></script>
<script src="https://www.kazforextraders.com/js/main.js"></script>
</body>
</html>
Пожалуйста, дайте мне знать, что я могу сделать, чтобы это исправить, любой оценит помощь.