he hecho algunos ajustes pero sigue dando problemas
me da un :
SMTP connect() failed. una ayudita chiquitos
Código PHP:
Ver original<?php
class MailManager{
private $Mail;
function __construct(){
$this -> Mail = new PHPMailer
(true); }
function regmail($username,$email,$nombre,$telf,$country,$date){
$Mail = $this -> Mail -> IsSMTP(); $body = "<br><br>
Hola, se a creado una cuenta en hosting para su acceso.<br>
<br>
Informacion:
Username: $username<br>
Nombre de usuario: $nombre<br>
E-Mail: $email<br>
Telefono: $telf<br>
Fecha de Registro: $date<br><br>
Contraseña: 123456<br><br>
<h2>Recuerde Cambiar la contraseña.</h2>
";
echo $body;
echo"paso uno ok";
try {
$Mail = $this -> CharSet = 'UTF-8';
$Mail = $this -> Host = 'smtp.gmail.com';
$Mail = $this -> SMTPdebug = 2;
$Mail = $this -> SMTPAuth = 'true';
$Mail = $this -> SMTPSecure = 'tls';
$Mail = $this -> Port = '587';
$Mail = $this -> Password = '123456';
$Mail = $this -> Mail ->AddAddress($email, $nombre); $subject = _SUBJECT;
$Mail = $this -> Subject = "
$subject Cuenta Creada para: $nombre";
$Mail = $this -> AltBody = "
Para ver Este mensaje Active la opcion HTML!";
/*$Mail = $this -> body =
"<br><br>
Hola, se a creado una cuenta en hosting para su acceso.<br>
<br>
Informacion:
Username: $username<br>
Nombre de usuario: $nombre<br>
E-Mail: $email<br>
Telefono: $telf<br>
Fecha de Registro: $date<br><br>
Contraseña: 123456<br><br>
<h2>Recuerde Cambiar la contraseña.</h2>
";*/
//$body;
$Mail = $this -> Mail -> Body = $body; $Mail = $this -> Mail -> Send(); echo "Message Sent OK<p></p>\n";
} catch (phpmailerException $e) {
echo"error 1";
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo"error 2";
echo $e->getMessage(); //Boring error messages from anything else!
}
}
}
?>