Phpmailer Error include

Asked

Viewed 226 times

0

I’m having a problem with the Phpmailer class. It’s giving a bug include. Could someone tell me the reason for the mistake?

inserir a descrição da imagem aqui

PHP code:

<?php

// Variaveis que vão ser enviadas
$nome = $_POST['nome'] ;
$txttelefone = $_POST['txttelefone'];
$email = $_POST['email'];
$mensagem = $_POST['mensagem'];


//Inclui os Arquivos
require ("PHPMailer/class.phpmailer.php");PHPMailer/

//Inicia a classe 
$mail = new PHPmailer ();


//Dados de envio
$mail->IsSMTP();
$email->Port = 587;
$mail->Host = "smtp.umbler.com";
$mail->SMTPAuth = true;
$mail->Username = 'alfatecteste-com-br';
$mail->Password = 'lj;f.C;/ACNIm@=';

//Remetente
$mail->From = "[email protected]";
$mail->FromName = "ADM";

//Destinatario
$mail->AddAddress ($email,$nome);
$mail->AddCC('[email protected]', 'Eu');

//envio em html 
$mail->IsHTML(true);

//Define a mensagem (Assunto)
$mail->Subject = "Mensagem do site";
$mail->Body = $mensagem;

//Envia o email
$enviar = $mail->Send();

//mensagem de resultado
if($enviar){
    alert('Obrigado(a)  ' + nome.value +' os seus dados foram encaminhados com sucesso');

}   else {
    alert('E-mail não Enviado !');

}



?>  

HTML code:

<form name="meu_form"  action="enviar.php"  method="post" name="form" >


                    <h1>Entre em contato</h1>

                    <p class="nome">
                        <input type="text" id="nomeid" placeholder="Nome Completo"  required="required" name="nome" />
                    </p>

                    <p class="fone">
                        <input type="tel" name="txttelefone" id="txttelefone" pattern="\([0-9]{2}\)[\s][0-9]{4}-[0-9]{4,5}"                                             placeholder="Telefone" required="required" />
                        <script type="text/javascript"> $("#txttelefone").mask("(00) 0000-00000");</script>          
                    </p>

                    <p class="email">
                       <input type="email"  id="email" value="" name="email" required="required" placeholder="Digite Seu E-mail"/>
                    </p>

                    <p>
                       <textarea placeholder="Deixe sua Mensagem" required="required" name="mensagem"></textarea>
                    </p>

                    <p class="submit">
                        <input type="submit" onclick="Enviar();" value="Enviar" name="enviar" />
                    </p>

            </form>
  • 1

    require ("PHPMailer/class.phpmailer.php");PHPMailer/ only remove all after the ; (point and comma)

  • On line 19 there’s a $email lost.

  • A tip is to look at the basic example available in the library itself at: https://github.com/PHPMailer/PHPMailer/blob/master/examples/smtp.phps

  • 1

    And in PHP there is no function alert. The way you’re using it, it seems to be the alert javascript.

  • 1

    Copy the error, do not post error photos and code, if it can be text then do as such, this helps in indexing the question for future searches.

  • check this path if it is correct Phpmailer/class.phpmailer.php

Show 1 more comment

1 answer

0

You got a mistake on that line:

//Includes the Archives require ("Phpmailer/class.phpmailer.php");Phpmailer/

Remove this: Phpmailer/

  • Didn’t work it seemed another mistake

  • New error that appeared after fixing the line //Includes the require files ("Phpmailer/class.phpmailer.php");Phpmailer/ https://i.stack.Imgur.com/3FMiH.jpg

  • I put an image showing the error above

Browser other questions tagged

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