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?
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>
require ("PHPMailer/class.phpmailer.php");PHPMailer/
only remove all after the;
(point and comma)– Don't Panic
On line 19 there’s a
$email
lost.– Woss
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
– Don't Panic
And in PHP there is no function
alert
. The way you’re using it, it seems to be thealert
javascript.– Woss
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.
– Guilherme Nascimento
check this path if it is correct Phpmailer/class.phpmailer.php
– user60252