Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/09/2014, 21:09
Avatar de arcanisgk122
arcanisgk122
 
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: agregar clase phpmailer

he hecho algunos ajustes pero sigue dando problemas

me da un : SMTP connect() failed. una ayudita chiquitos

Código PHP:
Ver original
  1. <?php
  2. class MailManager{
  3.     private $Mail;
  4.     function __construct(){
  5.         $this   ->  Mail    =   new PHPMailer(true);
  6.     }
  7.     function regmail($username,$email,$nombre,$telf,$country,$date){
  8.         $Mail   =   $this ->    Mail        ->  IsSMTP();
  9.         $body   =   "<br><br>
  10.                         Hola, se a creado una cuenta en hosting para su acceso.<br>
  11.                         <br>
  12.                         Informacion:
  13.                         Username: $username<br>
  14.                         Nombre de usuario: $nombre<br>
  15.                         E-Mail: $email<br>
  16.                         Telefono: $telf<br>
  17.                         Fecha de Registro: $date<br><br>
  18.                         Contraseña: 123456<br><br>
  19.                         <h2>Recuerde Cambiar la contraseña.</h2>
  20.             ";
  21.         echo $body;
  22.         echo"paso uno ok";
  23.         try {
  24.             $Mail   =   $this ->    CharSet     = 'UTF-8';
  25.             $Mail   =   $this ->    Host        = 'smtp.gmail.com';
  26.             $Mail   =   $this ->    SMTPdebug   = 2;
  27.             $Mail   =   $this ->    SMTPAuth    = 'true';
  28.             $Mail   =   $this ->    SMTPSecure  = 'tls';
  29.             $Mail   =   $this ->    Port        = '587';
  30.             $Mail   =   $this ->    Username    = '[email protected]';
  31.             $Mail   =   $this ->    Password    = '123456';
  32.             $Mail   =   $this ->    Mail        ->AddAddress($email, $nombre);
  33.             $Mail   =   $this ->    Mail        ->SetFrom('[email protected]', 'julio pela la yuca');
  34.             $subject    = _SUBJECT;
  35.             $Mail   =   $this ->    Subject     = "
  36.                                     $subject Cuenta Creada para: $nombre";
  37.             $Mail   =   $this ->    AltBody     = "
  38.                                     Para ver Este mensaje Active la opcion HTML!";
  39.            
  40.             /*$Mail =   $this ->    body        =
  41.                         "<br><br>
  42.                         Hola, se a creado una cuenta en hosting para su acceso.<br>
  43.                         <br>
  44.                         Informacion:
  45.                         Username: $username<br>
  46.                         Nombre de usuario: $nombre<br>
  47.                         E-Mail: $email<br>
  48.                         Telefono: $telf<br>
  49.                         Fecha de Registro: $date<br><br>
  50.                         Contraseña: 123456<br><br>
  51.                         <h2>Recuerde Cambiar la contraseña.</h2>
  52.                         ";*/
  53.             //$body;
  54.             $Mail   =   $this ->    Mail        ->  Body = $body;
  55.             $Mail   =   $this ->    Mail        ->  Send();
  56.             echo "Message Sent OK<p></p>\n";
  57.         } catch (phpmailerException $e) {
  58.             echo"error 1";
  59.             echo $e->errorMessage(); //Pretty error messages from PHPMailer
  60.         } catch (Exception $e) {
  61.             echo"error 2";
  62.             echo $e->getMessage(); //Boring error messages from anything else!
  63.         }
  64.     }
  65. }
  66. ?>
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB