PHP does not recognize auto Sponse

Asked

Viewed 29 times

0

I don’t know which error my form is not sending the email reply to the event subscriber. It redirects, I receive his data but it does not receive an email confirming the registration.

Can you help me? I will post my html and php code here.

HTML:

<form action="post.php" method="POST">
<input required type="text"  name="nome" type="name" class="form-control" id="nome">        
<input required name="email" type="text" class="form-control" id="email">
<input required type="text" placeholder="(DD)XXXXX-XXXX" name="celular" type="phone" class="form-control" id="celular">
<input required type="text" placeholder="XX/XX/XXXX" type="birthday" name="nascimento" class="form-control" id="nascimento">
<input required type="text"  type="number" name="cpf" class="form-control" id="nascimento">
<input name="endereco" required type="text" class="form-control" id="endereco">
<input name="numero" required type="text" class="form-control" id="numero">
<input name="complemento" type="text" class="form-control" id="complemento">
<input name="bairro" required type="text" class="form-control" id="bairro">
<input name="cidade" required type="text" class="form-control" id="cidade">
<input name="estado" required type="text" class="form-control" id="estado">
<input name="pais" required type="text" class="form-control" id="pais">
<input name="empresaouinstituicao" required type="text" class="form-control" id="empresa">
<input name="cargo" required type="text" class="form-control" id="cargo">
<input name="telcomercial" required type="text" class="form-control" id="tel-comercial">
<label>Como tomou conhecimento?  <span style="color: red">*</span>
    
    <select name="comosoube" required type="text" class="form-control" id="conhecimento">
        <option disabled selected value>Escolha uma opção</option>
        <option value="anuncios">opcao1</option>    
        <option value="apoiadores">opcao2</option>  
        <option value="crcapc">opcao3</option>  
        <option value="poremail">opcao4</option>          
        
    </select>

PHP

require_once("autenvio/PHPMailerAutoload.php");

$mail = new PHPMailer();

$mail->IsSMTP(); 
$mail->Host = "smtp.site1.com.br"; 
$mail->SMTPAuth = true; 
$mail->Port = 587;
$mail->SMTPSecure = false; 
$mail->SMTPAutoTLS = false; 
$mail->Username = '[email protected]'; 
$mail->Password = '********';

$mail->Sender = "[email protected]"; 
$mail->From = "[email protected]"; 
$mail->FromName = "[email protected]"; 

$mail->AddAddress('[email protected]', 'Nome - Recebe1'); 

$mail->IsHTML(true); 
$mail->CharSet = 'utf-8'; 

$mail->Subject  = "formulario"; // 
$mail->Body .= "".$_POST['nome'].";".$_POST['email'].";".$_POST['celular'].";".$_POST['nascimento'].";".$_POST['cpf'].";".$_POST['endereco'].";".$_POST['numero'].";".$_POST['complemento'].";".$_POST['bairro'].";".$_POST['cidade'].";".$_POST['estado'].";".$_POST['pais'].";".$_POST['cep'].";".$_POST['publicoouprivado'].";".$_POST['empresaouinstituicao'].";".$_POST['cargo'].";".$_POST['telcomercial'].";".$_POST['comosoube']."
"; 

$enviado = $mail->Send();

$mail->ClearAllRecipients();

if($mail->Send()) {
    $autoRespond = new PHPMailer();
    
    $autoRespond->IsSMTP();
    $autoRespond->CharSet    = 'UTF-8';
    $autoRespond->SMTPDebug  = 0;
    $autoRespond->SMTPAuth   = TRUE;
    $autoRespond->SMTPSecure = false;
    $autoRespond->Port       = 587;
    $autoRespond->Username   = "[email protected]";
    $autoRespond->Password   = "********";
    $autoRespond->Host       = "smtp.site1.com.br";
    
    $autoRespond->setFrom('[email protected]', 'inscricao');
    $autoRespond->addAddress($_email);
    $autoRespond->Subject = "INSCRICAO RECEBIDA"; 
    $autoRespond->Body = "Nós recebemos sua Inscrição no evento";
    
    $autoRespond->Send(); 
}

$urls = array(
'anuncios'=>'confirmacao.html',
'apoiadores'=>'confirmacao.html',
'crcapc'=>'confirmacaocrcapc.html',
'poremail'=>'confirmacao.html');
if (!empty($_REQUEST['comosoube'])) {
    $soube = $_REQUEST['comosoube'];
    $qs = $_SERVER['QUERY_STRING'];
    $qs = ($qs != '') ? '?' . $qs : "";
    $url = $urls[$soube] . $qs;
    header("location: $url");
}
  • Good afternoon. Already tried to put $mail = new PHPMailer(true);? When you put true, you activate the exceptions. Maybe it makes it easier to view the error.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.