0
I’m trying to recover e-mail and password, where:
$o_email = $_GET['email'];
$celular = $_GET['celular'];
Receives via URL the user’s email or mobile phone. But I am not able to get these recovered data to play in phpmailer.
What could I be doing wrong?
<?php
header('Content-type: application/json; charset=iso-8859-1"');
header('Access-Control-Allow-Origin: *');
include 'database.php';
include '../phpMailer/PHPMailerAutoload.php';
$o_email = $_GET['email'];
$celular = $_GET['celular'];
$consulta = $pdo->prepare("SELECT nome, email, senha, celular FROM usuario_app WHERE email = '$o_email' OR (celular = '$celular')");
$consulta->execute();
$linha = $consulta->rowCount();
foreach($consulta as $mostra):
$nome = addslashes(strip_tags($mostra['nome']));
$email = addslashes(strip_tags($mostra['email']));
$senha = addslashes(strip_tags($mostra['senha']));
endforeach;
if($linha):
$_SESSION['nome'] = $nome;
$_SESSION['email'] = $email;
$_SESSION['senha'] = $senha;
endif;
echo $nome;
echo $email;
echo $senha;
$html = 'Olá ' . $nome . ', você pediu para recuperar sua senha. <br></br>
A sua senha é: ' . $senha . '
<br></br>
Atenciosamente,
<br></br>
<b>Equipe VovóCooks,</b>
www.vovocooks.com.br';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.zoho.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'sucessomundial2017'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('[email protected]', 'VovoCooks App');
//$mail->addAddress('[email protected]', 'VovóCooks App'); // Add a recipient
$mail->addAddress($email); // Name is optional
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Seu login e senha do VovoCooks App.';
$mail->Body = $html;
if(!$mail->send()) {
echo 'A mensagem não pode ser enviada.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Mensagem enviada';
echo json_encode(array('message'=> 'Sua senha foi enviada para seu e-mail: ' + $to));
}
?>
In this your code above there are no errors. I tested on my server and works correctly. Maybe there is error in the form, path of includes. Post the form.
– user60252