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<html>
<head>
<?php
require("Envio_Correo.php");
?>
</head>
<body>
<form action="" method="POST">
<!-- <ul>
<li> -->
<label> Emails </label>
<input type="text" name="texto" ></input>
<!-- </li>
<li> -->
<label> Asunto </label>
<input type="text" name="asunto"></input>
<!-- </li>
<li>-->
<label> Mensaje </label>
<input type="text" name="mensaje"></input>
<input type="submit" name="btn_enviar" value="Agregar Correos" ></input>
<!-- </li>
</ul> -->
</form>
</body>
<?php
if(isset($_POST['btn_enviar'])){ global $array;
$correo = $_POST['texto'];
$asunto = $_POST['asunto'];
$msn = $_POST['mensaje'];
$array[] = $correo;
$email = new Envio_Correo();
$email->Mensaje_asunto($asunto);
$email->Mensaje_factura($msn);
$email->Agregar_direcciones($array);
$email->Send();
}
?>
</html>
-----------------------------------------------------------------------
<?php
require "class.phpmailer.php"; <------ se encuentra en el mismo directorio de las clase que estan aqui
class Envio_Correo {
public $array_direcciones;
public $error;
public $mail = null;
function __construct(){
$this->mail = new phpmailer
(); $array_direcciones = array(); $this->mail->PluginDir = ""; //"includes/";
$this->mail->Mailer = "smtp";
$this->mail->Host = "mx1.hostinger.co";
$this->mail->SMTPAuth = false;
$this->mail->Password = "xxxxxxx";
$this->mail->Port = 2525;
$this->mail->FromName = "Web Ecommerce..";
$this->mail->AltBody ="Mensaje de prueba mandado con phpmailer en formato texto";
$this->mail->Timeout=120;
}
function Mensaje_asunto($msg){
$this->mail->Subject = $msg;
}
function Mensaje_factura($msg){
$this->Body = $msg;
}
function Mensaje_activacion($msg){
$this->Body = $msg;
}
function Mensaje_promosional($msg){
$this->Body = $msg;
}
function Mensaje_informativo($msg){
$this->Body = $msg;
}
function Agregar_direcciones($direcciones){
$this->array_direcciones = $direcciones ;
}
function Send(){
reset($this->array_direcciones); while (list($clave, $valor)=each($this->array_direcciones)) { $this->mail->AddAddress($valor);
$exito = $this->mail->Send();
$intentos = 1;
while((!$exito)&&($intentos<5)&&($this->mail->ErrorInfo!="SMTP Error: Data not accepted")){
$exito = $this->mail->Send();
$intentos=$intentos+1;
}
if ($this->mail->ErrorInfo=="SMTP Error: Data not accepted") {
$exito=true;
}
if(!$exito){
echo "Problemas enviando correo electrónico a ".$valor;
echo "<br/>".$this->mail->ErrorInfo;
}else{
$mensaje="<p>Has enviado un mensaje a:<br/>";
$mensaje.=$valor." ";
if ($archivo !="none") {
$mensaje.="Con un fichero adjunto llamado ".$archivo_name;
}
$mensaje.="</p>";
echo $mensaje;
}
$this->mail->ClearAddresses();
}
}
}
?>