I'm trying to send an email with several variables passed via post. I can not send the contents of the email with all the variables. What would be the correct syntax? Here is the code:
$name = $_POST['nome'];
$zip = $_POST['cep'];
$adress = $_POST ['endereco'];
$number = $_POST['numero'];
$comp = $_POST['complemento'];
$neigh = $_POST['bairro'];
$city = $_POST['cidade'];
$state = $_POST['estado'];
$iemail = $_POST['email'];
$phone = $_POST['telefone'];
$product = $_POST['produto'];
$model = $_POST['modelo'];
$brand = $_POST['marca'];
$report = $_POST['laudo'];
$date = $_POST['data'];
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.meudominio.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]';// SMTP username
$mail->Password = 'minhasenha'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, 'ssl' also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('[email protected]', 'Contato');
$mail->addAddress($iemail); // Add a recipient
$mail->addReplyTo('[email protected]', 'Contato');
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Sua Ordem de Serviço Grupo SAB';
$mail->Body = '
<table id="recibo">
<h1>Ordem de serviço</h1>
<p>Cliente:'.$name'</p>
<p>CEP:'.$zip'</p>
<p>Endereço:'.$adress'</p>
<p>Numero:'.$number'</p>
<p>Complemento:'.$comp'</p>
<p>Bairro:'.$neigh'</p>
<p>Cidade:'.$city'</p>
<p>Estado:'.$state'</p>
<p>Produto:'.$produtc'</p>
<p>Modelo:'.$model'</p>
<p>Marca:'.$brand'</p>
<p>Laudo:'.$report'</p>
</table>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
? >