I'm making a system for sending emails with contact form data to the admin. So far so good, I have managed to configure everything, send the email, but there is a very peculiar problem. The message and subject data are not sent to the email. It simply goes with the name of the variable, without the value of it. How to solve? Here are the form and php codes:
contact.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=1423" />
<title>Contato | Lizard Fishing</title>
<link rel="stylesheet" href="style/estilo.css" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans|Roboto" rel="stylesheet">
<script src="js/script.js"></script>
<link rel="icon" type="image/png" href="icon/favicon.png" />
<meta name="author" content="Samuel Santos, Thiago Lamonica e Ruan Vicente Bianco" />
<meta name="robots" content="all" />
<meta name="rating" content="general" />
</head>
<body>
<header class="header header_geral">
<?php
include "header.html";
?>
</header>
<main class="main main_geral main_contato">
<h2 class="title_content">Contato</h2>
<h3 class="subtitle_content subtitle_contato">Entre em contato conosco!</h3>
<br />
<div class="form_contato">
<form name="form_contato" method="post" action="enviar_contato.php">
<p>
<label>Nome:</label>
<br />
<input type="text" name="nome_contato" class="text_input" size="38" required />
</p>
<p>
<label>E-mail:</label>
<br/>
<input type="email" name="email_contato" class="text_input" size="38" required />
</p>
<p>
<label>Assunto</label>
<br/>
<input type="text" name="assunto_contato" class="text_input" size="38" required />
</p>
<p>
<label>Mensagem:</label>
<br/>
<textarea name="mensagem_contato" rows="10" cols="40" class="text_input" required ></textarea>
</p>
<p>
<input type="submit" value="Enviar" class="button_submit" />
</p>
</form>
</div>
<div class="dados_contato">
<p class="text_content text_contato">
<a href="https://www.facebook.com/Lizard-Fishing-Equipamentos-Para-Pesca-361157610633775" class="link_fb" target="_blank"><img src="icon/fb.png" width="25" class="icon_fb" /> <b>Lizard Fishing</b></a>
<br/>
<b>Televendas:</b> (55)11 2534-7082
<br/>
<b>Celular:</b> (55)11 96437-8004
<br/>
<b>E-mail:</b> [email protected]
</p>
</div>
</main>
</body>
</html>
send_contact.php
<?php
$nome=$_POST["nome_contato"];
$email=$_POST["email_contato"];
$assunto=$_POST["assunto_contato"];
$mensagem=$_POST["mensagem_contato"];
include 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.live.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "*********";
$mail->setFrom('[email protected]', 'Administrador');
$mail->addAddress('$email_contato', '$nome_contato');
$mail->addReplyTo('$nome_contato', '$nome_contato');
$mail->addCC('[email protected]', 'Administrador');
$mail->isHTML(true);
$mail->Subject = '$assunto_contato';
$mail->Body = '$mensagem_contato';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>