Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/12/2014, 06:43
andres18281
 
Fecha de Ingreso: febrero-2013
Ubicación: Cali Colombia
Mensajes: 118
Antigüedad: 11 años, 2 meses
Puntos: 0
Respuesta: PhpMailer problemas de envio

Bueno gente... Ya no genera error pero si genera el
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

He buscado registro de log en el servidor pero no muestra nada.

Código PHP:
Ver original
  1. <html>
  2. <head>
  3. <?php
  4. require("Envio_Correo.php");
  5. ini_set("display_errors", 1);
  6.  
  7.  ?>
  8. </head>
  9.     <body>
  10.         <form action="" method="POST">
  11.        <!-- <ul>
  12.             <li> -->
  13.         <label> Emails </label>
  14.         <input type="text" name="texto" ></input>
  15.            <!-- </li>
  16.             <li> -->        
  17.         <label> Asunto </label>
  18.         <input type="text" name="asunto"></input>
  19.            <!-- </li>
  20.             <li>-->        
  21.         <label> Mensaje </label>
  22.         <input type="text" name="mensaje"></input>
  23.         <input type="submit"  name="btn_enviar" value="Agregar Correos" ></input>  
  24.          <!-- </li>        
  25.         </ul> -->        
  26.         </form>
  27.     </body>
  28.  
  29.        
  30. <?php
  31.  
  32.             if(isset($_POST['btn_enviar'])){
  33.                 global $array;
  34.                 $correo = $_POST['texto'];
  35.                 $asunto = $_POST['asunto'];
  36.                 $msn = $_POST['mensaje'];
  37.                 $array[] = $correo;
  38.                 $email = new Envio_Correo();
  39.                 $email->Mensaje_asunto($asunto);
  40.                 $email->Mensaje_factura($msn);
  41.                 $email->Agregar_direcciones($array);  
  42.                 $email->Send();  
  43.      
  44.             }
  45.          
  46.         ?>
  47.  
  48.  
  49. </html>
  50.  
  51. -----------------------------------------------------------------------
  52. <?php
  53. require "class.phpmailer.php"; <------ se encuentra en el mismo directorio de las clase que estan aqui
  54.  
  55.     class Envio_Correo {
  56.  
  57.        public $array_direcciones;
  58.        public $error;
  59.        public $mail = null;
  60.        function __construct(){  
  61.         $this->mail = new phpmailer();
  62.         $array_direcciones = array();
  63.         $error =  array();
  64.         $this->mail->PluginDir = ""; //"includes/";
  65.         $this->mail->Mailer = "smtp";
  66.         $this->mail->Host = "mx1.hostinger.co";
  67.         $this->mail->SMTPAuth = false;
  68.         $this->mail->Username = "[email protected]";
  69.         $this->mail->Password = "xxxxxxx";
  70.         $this->mail->Port = 2525;
  71.         $this->mail->From = "[email protected]";
  72.         $this->mail->FromName = "Web Ecommerce..";
  73.         $this->mail->AltBody ="Mensaje de prueba mandado con phpmailer en formato texto";
  74.         $this->mail->Timeout=120;
  75.        }
  76.         function Mensaje_asunto($msg){
  77.             $this->mail->Subject = $msg;
  78.         }
  79.  
  80.         function Mensaje_factura($msg){
  81.             $this->Body = $msg;
  82.         }
  83.      
  84.         function Mensaje_activacion($msg){
  85.             $this->Body = $msg;
  86.         }
  87.  
  88.         function Mensaje_promosional($msg){
  89.             $this->Body = $msg;
  90.         }
  91.  
  92.         function Mensaje_informativo($msg){
  93.             $this->Body = $msg;
  94.         }
  95.  
  96.         function Agregar_direcciones($direcciones){
  97.  
  98.            $this->array_direcciones = $direcciones ;
  99.         }
  100.  
  101.         function Send(){
  102.    
  103.           reset($this->array_direcciones);
  104.           while (list($clave, $valor)=each($this->array_direcciones)) {
  105.             $this->mail->AddAddress($valor);
  106.             $exito = $this->mail->Send();
  107.             $intentos = 1;
  108.             while((!$exito)&&($intentos<5)&&($this->mail->ErrorInfo!="SMTP Error: Data not accepted")){
  109.               sleep(5);
  110.               $exito = $this->mail->Send();
  111.               $intentos=$intentos+1;      
  112.             }
  113.             if ($this->mail->ErrorInfo=="SMTP Error: Data not accepted") {
  114.               $exito=true;
  115.               array_push($error,$this->mail->ErrorInfo);
  116.             }
  117.             if(!$exito){
  118.               echo "Problemas enviando correo electrónico a ".$valor;
  119.               echo "<br/>".$this->mail->ErrorInfo;
  120.             }else{
  121.               $mensaje="<p>Has enviado un mensaje a:<br/>";
  122.               $mensaje.=$valor." ";
  123.               if ($archivo !="none") {
  124.                 $mensaje.="Con un fichero adjunto llamado ".$archivo_name;
  125.               }
  126.               $mensaje.="</p>";
  127.                 echo $mensaje;
  128.             }
  129.               $this->mail->ClearAddresses();
  130.           }
  131.       }
  132.    
  133.   }
  134.      
  135.  
  136. ?>