When I try to send an email using quotes using phpmailler the email does not send,

Asked

Viewed 21 times

1

Guys I’d like your help!

I set up phpmailler in my project and everything worked right, but when I try to send an email with single or double quotes the email does not send! how do I resolve without losing the content when sending the email?

try {
    $mail->SMTPOptions = array(
            'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        ));

    $mail->isSMTP();                                            // Send using SMTP
    $mail->Host       = 'smtp.gmail.com';                    // Set the SMTP server to send through
    $mail->SMTPAuth   = true;                                   // Enable SMTP authentication
    $mail->Username   = '';                     // SMTP username
    $mail->Password   = '';                               // SMTP password
    $mail->SMTPSecure = 'tls';          // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
    $mail->Port       = 587;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
    $mail->Encoding = 'base64';


    //Recipients
    $mail->setFrom('',$username);
    $mail->addAddress($_POST['email']);     // Add a recipient

    // Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = $titulo;
    $mail->Body =  "$corpoEmail <br><br> Status da solicitação : ".$status_solicitacao;
    $mail->AltBody = "$corpoEmail <br><br> Status da solicitação : ".$status_solicitacao;
   
    if (mysqli_query($conn, $update)) {
        insert_ocorrencia();
        $mail->send();
        echo"<script language='javascript' type='text/javascript'>alert('Solicitação concluida com sucesso!');window.location.href='../pages/backlog.php';</script>";
        
    }else{
        echo"<script language='javascript' type='text/javascript'>alert('Erro na conclusão da solicitação');window.location.href='../pages/backlog.php';</script>";
    }
} catch (Exception $e) {
    
    echo"<script language='javascript' type='text/javascript'>alert('Erro no envio do email');window.location.href='../pages/backlog.php';</script>";
    
}
  • 2

    Cade o eu código?

  • I just edited the post and put the code

  • Have you tried using html_decode_entity("$corpoEmail <br><br> Status da solicitação : ".$status_solicitacao");

  • I used html_entity_decode but continued to show error

No answers

Browser other questions tagged

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