I have the following form
on my page index.php
:
<form id="form-contato" method="post" action="email.php">
<div>
<div class="row">
<div class="6u 12u(mobile)">
<input type="text" name="name" id="nome" placeholder="Nome" />
</div>
<div class="6u 12u(mobile)">
<input type="text" name="email" id="email" placeholder="Email" />
</div>
</div>
<div class="row">
<div class="12u">
<input type="text" name="subject" id="assunto" placeholder="Assunto" />
</div>
</div>
<div class="row">
<div class="12u">
<textarea name="message" id="mensagem" placeholder="Mensagem"></textarea>
</div>
</div>
<div class="row 200%">
<div class="12u">
<ul class="actions">
<li><input type="submit" value="Enviar mensagem"/></li>
<li><input type="reset" value="Limpar campos" class="alt" /></li>
</ul>
</div>
</div>
</div>
</form>
I created an email.php page to send the completed data in the index.php form:
<?php
require_once("phpmailer.php");
error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Sao_Paulo');
$ip = getenv("REMOTE_ADDR");
// variáveis que guardam os dados vindo do form
$nome = utf8_decode($_POST['nome']);
$email = utf8_decode($_POST['email']);
$assunto = utf8_decode($_POST['assunto']);
$mensagem = utf8_decode($_POST['mensagem']);
$Email = new PHPMailer();
$Email->SetLanguage("br");
$Email->IsMail();
$Email->IsHTML(true);
$Email->From = $email;
$Email->FromName = $nome;
$Email->AddAddress("[email protected]");
$Email->Subject = $assunto;
$Email->AddBcc($email);
if(!$Email->Send()) {
echo "Erro: " . $Email->ErrorInfo;
} else {
echo "Mensagem enviada!";
}
But the email is not being sent. What is missing?