0
I would appreciate your help. The system I am creating randomly registers a password using Hash and I use the email as login. This data is in the comic book. Now I need to send an email to the user informing this data so that he can enter the system.
I’m trying to do this using the file that receives the data from the registration screen but I’m not succeeding as I could do to get it fixed?
Follow the add-couple file
<?php require_once ("conecta.php");?>
<?php require_once ("noivosDAO.php");?>
<?php require_once ("noivos.php");?>
<?php
$noivo = new Noivo();
$noivo->setNome1($_POST["nome1"]) ;
$noivo->setSobrenome1($_POST["sobrenome1"]);
$noivo->setEmail($_POST["email"]);
$noivo->setNome2($_POST["nome2"]);
$noivo->setSobrenome2($_POST["sobrenome2"]);
$noivo->setTelefone($_POST["telefone"]);
$noivo->setRua($_POST["rua"]);
$noivo->setNumero($_POST["numero"]);
$noivo->setCep($_POST["cep"]);
$noivo->setCidade($_POST["cidade"]);
$noivo->setSenha();
$nome_imagem = $noivo->setFoto( $_FILES["foto"]);
$dao = new noivosDAO($conexao);
if ($dao->insereNoivos($noivo, $nome_imagem, $email, $senha)) {
// Mail it
$email = $_POST["email"];
$senha = $_POST["senha"];
require_once("PHPMailerAutoload.php");
require_once("class.phpmailer.php");
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.xxxxxxxxxxxx.com.br';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "xxxxxxxxx";
$mail->setFrom("[email protected]", "xxxxxxxxxxxxxx");
$mail->addAddress($email);
$mail->Subject = "Contato site xxxxxxxxxxxxx";
$mail->MsgHTML($body);
$body = "<html>
<head>
<title>Registro xxxxxxxxxxxxxxxxxxxxx</title>
</head>
<body>
<p>Obrigado por se registrar em nosso site, segue abaixo seu login e senha
para acesso:</p>
<table>
<tr>
<p> Login: {$email}</p>
</tr>
<tr>
<p> Senha: {$senha}</p>
</tr>
<tr>
<p>Link para acesso: <a href 'https://xxxxxxxxxxxxxxxxx/login.php'</a></p>
</tr>
</table>
</body>
</html>"
;
if($mail->Send())
$msg = "<center><h1>Dados enviados com sucesso.</h1>
Você receberá um e-mail para confirmar seu cadastro.<br/>
Confirme seu cadastro para receber nossas mensagens.<br/><br/>
Obrigado.</center>";
else
$msg = "<center><h1>Dados não enviados</h1>
Por favor, tente novamente.</center>";
?>
<div>
<?php
if(isset($msg))
echo "$msg";
?>
</div>
<?php
var_dump($mail); exit;
?>
Which error is returning ?
– sNniffer