0
People my program is giving a single syntax error on the penultimate line and I do not understand why. Someone help me pf.
<?php
session_start();
setlocale(LC_CTYPE,"pt_BR");
require_once 'PHPMailer/class.phpmailer.php';
require_once 'PHPMailer/class.smtp.php';
function sendMail($para,$de,$mensagem,$assunto)
{
//dados tmp
$smtp= "smtp.gmail.com";
$usuario="[email protected]";
$senha = "xxxxxxxxxxx";
$mail = new smtp;
$mail->Delivery('relay');
$mail->Relay($smtp,$usuario,$senha,465,'login',true);
$mail->TimeOut(10);
$mail->Priority('high');
$mail->From($de);
$mail->AddTo($para);
$mail->Html($mensagem);
if($mail->Send($assunto))
{
echo "alert('Deu certo')";
$_SESSION['feedback']="Mensagem enviada com sucesso";
header ("Location: feedback_index.html");
}
else
{
echo "alert('Deu errado')";
$_SESSION['feedback'] ="Mensagem não foi enviada";
header("Location: feedback_index.html");
}
}
$nome = $_POST['nome'];
$assunto = $_POST['assunto'];
$email = $_POST['email'];
$mensagem = $_POST['mensagem'];
$corpo =
'<html>
<head>
</head>
<body>
Nome:<br>'.$nome.'<p>
Email:<br>'.$email.'<p>
Assunto:<br>'.$assunto.'<p>
Menssagem:<br>'.$mensagem.'<p>
</body>
</html>';
sendMail('[email protected]',$email,$corpo,$assunto); //está dando erro aqui
?>
And what exactly is the error message?
– Woss
is missing . com in your email!
– Jonathan de Toni
@Jonathandetoni I put ". com" and the error continued
– Gisele Almeida
@Andersoncarloswoss it from the syntax error "ERROR 500".
– Gisele Almeida
Try using port 587. Often used gmail, Hotmail and the like...
– Jonathan de Toni
@Jonathandetoni still nothing working kkk I’ll try to do again.
– Gisele Almeida
Ok, so redo and if it generates a different error, or fix edits your question with the solution.
– Jonathan de Toni
In the server error log a more detailed error message should appear.
– Woss
You are testing
localmente
or on your server?– Rafael Augusto
$mail = new smtp; Wouldn’t be new Phpmailer()
– Leo Nogueira
Add the error message to the question to make it clear to everyone.
– Isac
@Rafaelaugusto using on the server
– Gisele Almeida
@Leonogueira but I’m using SMTP, why would I put Phpmailer()?
– Gisele Almeida