Foros del Web » Programando para Internet » PHP »

listas de correo, por favor, ayuda

Estas en el tema de listas de correo, por favor, ayuda en el foro de PHP en Foros del Web. por favor, si alguien puede ayudarme , necesito configurar un script de lista de correo y newsletters sobre windows xp, luego seguramente lo subire a ...
  #1 (permalink)  
Antiguo 17/11/2003, 00:50
 
Fecha de Ingreso: diciembre-2002
Mensajes: 473
Antigüedad: 21 años, 4 meses
Puntos: 0
Exclamación listas de correo, por favor, ayuda

por favor, si alguien puede ayudarme , necesito configurar un script de lista de correo y newsletters sobre windows xp, luego seguramente lo subire a un servidor unix.
necesitaria algo sencillo que me permita enviar mails como si fuera un cliente de mails pero via web y si se puede administrar el tema usuarios mejor. con phplist he tenido algunos problemas y probe con listmessenger.este ultimo parece muy bueno y sencillo pero no puedo mandar los mails.
alguien sabe que puede ser?
gracias
tico
  #2 (permalink)  
Antiguo 17/11/2003, 03:10
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
si es mediante web, podrias hacerlo tu mismo

Código PHP:
<?php
/**
* Clase para el envio de email(s) via SMTP o mail()
* Clase para el evio multiple o simple de email(s) via SMTP o
* por medio de la funcion mail().
* Tambien comprueba si los email son validos o no y en
* la conexion al servidor puede ser con o sin login de usuario.
* @version   2.0a
* @author MSDark ([email protected])
* @copyright MSDark
*/
class email
{
var 
$asunto;
var 
$direcciones;
var 
$remitente;
var 
$mensaje;
var 
$enviado;
var 
$error;
var 
$comprobar;
/**
* Constructor de la clase
*
* Setea el valor de asunto, mensaje,remitente
* y direcciones, mada a revisar los email o devuelve cierto error.
*
* @param asunto = asunto del email
* @param direccion = direccion del email
* @param mensaje =mensaje de email
* @param remitente = remitente del email
* @acces private
*/
function email($asunto,$direccion,$mensaje,$remitente)
{
 if(empty(
$asunto) || empty($direccion) || empty($mensaje) || empty($remitente) ){
 return 
$this->error(1);
 }else{
 
$this->asunto=$asunto;
 
$this->direcciones=$direccion;
 
$this->mensaje=$mensaje;
 
$this->remitente=$remitente;

 
$this->comprobar($direccion,$remitente);
  if(!
$this->comprobar){
    return 
$this->error(2);
    }
//if

 
}   //if-else
}  //funcion
/**
* Setea el error que pueda ocurrir durante ejecucion
*
* @param e = error ocurrido durante ejecucion
* @acces private
*
*/
function error($e)
{
 switch(
$e){
 case 
1:
 return 
$this->error="No has completado todos los datos";
 break;
 case 
2:
 return 
$this->error="El/los email(s) de remitente y/o destino son invalidos";
 break;
 case 
3:
 return 
$this->error="No se han establecido los campos necesarios";
 break;
 case 
4:
 return 
$this->error="No se puede enviar el/los email(s)";
 break;
 case 
5:
 return 
$this->error="No se puede realizar conexion con el servidor SMTP <b>$errn: error</b>";
 break;
 case 
6:
 return 
$this->error="No se puede establecer comunicacion con el servidor";
 break;
 case 
7:
 return 
$this->error="No se puede cerrar conexion con el servidor";
 break;
 default:
 break;
 }
//switch
//funcion
/**
* Devuelve el error ocurrido
*
* @acces private
*
* @return string El error ocurrido
*/
function errores()
{
return 
$this->error;
}
//funcion
/**
* Comprueba los email de destino y remitente
*
* Comprueba si ambos campos son validos es decir contiene @, '.' y un dominio valido.
* @param direccion = direccion del email
* @param remitente = remitente del email{
* @acces private
*
* @return booleano
*/
function comprobar($direccion,$remitente)
{
$this->comprobar=false;
 if((@
is_array($direccion)) && (@is_array($remitente))){

    for(
$i=0$i<@count($direccion); $i++){
   if ((@
strlen($direccion[$i]) >= 3) && (@substr_count($direccion[$i],"@") == 1) && (@substr($direccion[$i],0,1) != "@") && (@substr($direccion[$i],@strlen($direccion[$i])-1,1) != "@") && (@strlen($remitente[$i]) >= 6) && (@substr_count($remitente[$i],"@") == 1) && (@substr($remitente[$i],0,1) != "@") && (@substr($direccion[$i],@strlen($remitente[$i])-1,1) != "@")){
    if ((!@
strstr($direccion[$i],"'")) && (!@strstr($direccion[$i],"\"")) && (!@strstr($direccion[$i],"\\")) && (!@strstr($direccion[$i],"\$")) && (!@strstr($direccion[$i]," ")) &&  (!@strstr($remitente[$i],"'")) && (!@strstr($remitente[$i],"\"")) && (!@strstr($remitente[$i],"\\")) && (!@strstr($remitente[$i],"\$")) && (!@strstr($remitente[$i]," "))) {
     if ((@
substr_count($direccion[$i],".")>= 1) && (@substr_count($remitente[$i],".")>= 1)){
          
$term = @substr(@strrchr ($direccion[$i], '.'),1);
            
$term2= @substr(@strrchr ($remitente[$i], '.'),1);
            if (@
strlen($term)>&& @strlen($term)<&& (!@strstr($term,"@"))  &&  @strlen($term2)>&& @strlen($term2)<&& (!@strstr($term2,"@"))){
            
$antes = @substr($direccion[$i],0,@strlen($direccion[$i]) - @strlen($term) - 1);
            
$antes2 = @substr($remitente[$i],0,@strlen($remitente[$i]) - @strlen($term) - 1);
            
$caracter = @substr($antes,@strlen($antes)-1,1);
            
$caracter2= @substr($antes2,@strlen($antes2)-1,1);
             if (
$caracter != "@" && $caracter != "." && $caracter2 !="@" && $caracter2 !="."){
             
$this->comprobartrue;
             }
      }
     }
    }
   }
    }
    
     if(
$this->comprobar){
     return 
$this->comprobar=true;
     }else{
     return 
$this->comprobar=false;
     }
 }else{
   if ((@
strlen($direccion) >= 3) && (@substr_count($direccion,"@") == 1) && (@substr($direccion,0,1) != "@") && (@substr($direccion,@strlen($direccion)-1,1) != "@") && (@strlen($remitente) >= 6) && (@substr_count($remitente,"@") == 1) && (@substr($remitente,0,1) != "@") && (@substr($direccion,@strlen($remitente)-1,1) != "@")){
    if ((!@
strstr($direccion,"'")) && (!@strstr($direccion,"\"")) && (!@strstr($direccion,"\\")) && (!@strstr($direccion,"\$")) && (!@strstr($direccion," ")) &&  (!@strstr($remitente,"'")) && (!@strstr($remitente,"\"")) && (!@strstr($remitente,"\\")) && (!@strstr($remitente,"\$")) && (!@strstr($remitente," "))) {
     if ((@
substr_count($direccion,".")>= 1) && (@substr_count($remitente,".")>= 1)){
          
$term = @substr(@strrchr ($direccion'.'),1);
            
$term2= @substr(@strrchr ($remitente'.'),1);
            if (@
strlen($term)>&& @strlen($term)<&& (!@strstr($term,"@"))  &&  @strlen($term2)>&& @strlen($term2)<&& (!@strstr($term2,"@"))){
            
$antes = @substr($direccion,0,@strlen($direccion) - @strlen($term) - 1);
            
$antes2 = @substr($remitente,0,@strlen($remitente) - @strlen($term) - 1);
            
$caracter = @substr($antes,@strlen($antes)-1,1);
            
$caracter2= @substr($antes2,@strlen($antes2)-1,1);
             if (
$caracter != "@" && $caracter != "." && $caracter2 !="@" && $caracter2 !="."){
             
$this->comprobar=true;
             }
      }
     }
    }
   }
     if(
$this->comprobar){
     return 
$this->comprobar=true;
     }else{
     return 
$this->comprobar=false;
     }
 }
}
//funcion

/**
* Envia el email
*
* Envia el email mediante funcion mail()
* @acces private
*
*/
function enviar()
{
if(!
$this->direcciones || !$this->asunto || !$this->mensaje || !$this->remitente ){
return 
$this->error(3);
}else{
 if(@
is_array($this->direcciones) || @is_array($this->asunto) || @is_array($this->mensaje) || @is_array($this->remitente)){
  for(
$i=0;$i<count($this->direcciones);$i++){
   if(!@
mail($this->direcciones[$i],$this->asunto[$i],$this->mensaje[$i],"FROM : ".$this->remitente[$i]."\r\nReply To: ".$this->remitente[$i]."\r\n")){
    return 
$this->error(4);
   }else{
    return 
$this->enviado=true;
   }
  }
//fin for
    
}else{
      if(!@
mail($this->direcciones,$this->asunto,$this->mensaje,"FROM : ".$this->remitente."\r\nReply To: ".$this->remitente."\r\n")){
    return 
$this->error(4);
    }else{
    return 
$this->enviado=true;
    }
    }
 }        
}    
//funcion
/**
* Devuelve un mensaje de aviso del envio del mail
*
* @acces private
*
* @return string
*/
function enviado()
{
    if(!
$this->enviado){
        return;
    }else{
        if(
$this->enviado){
            return 
"Email(s) enviado";
        }else{
            return 
"Email(s) no enviado";
        }
    }
}
//funcion
/**
* Envia el mail por medio de sockets
*
* Envia el mail por medio de sockets SMTP, con posibilidad de untentificar el usuario.
* @param server = servidor SMTP
* @param port = puerto SMTP
* @param user = usuario del servidor por defecto ""
* @param pass = password del servidor por defecto ""
* @acces private
*
* @param string $user
* @param string $pass
*/
function smtp($server,$port,$user="",$pass="")
{
if(!
$this->direcciones || !$this->asunto || !$this->mensaje || !$this->remitente ){
return 
$this->error(3);
}else{
 
$fp=fsockopen($server,$port,&$errn,&$error,30) or ($this->error(5));
 echo 
fgets($fp,1024);
 
fputs($fp,"EHLO 71675615@globalcom\r\n");
 
fgets($fp,1024);
  if(
$user!="" || $pass!=""){
  
$auth="AUTH LOGIN\r\n";
  
fputs($fp,$auth."\r\n") or ($this->error(6));
  
fgets($fp,1024);
  
$user=base64_encode($user);
  
fputs($fp,$user."\r\n") or ($this->error(6));
  
fgets($fp,1024);
  
$pass=base64_encode($pass);
  
fputs($fp,$pass."\r\n") or ($this->error(6));
  
fgets($fp,1024);
  }
    if(@
is_array($this->direcciones) || @is_array($this->asunto) || @is_array($this->mensaje) || @is_array($this->remitente)){
     for (
$i=0;$i<count($this->direcciones);$i++){
      
fputs($fp,"MAIL FROM:".$this->remitente[$i]."\r\n") or ($this->error(6));
      
fgets($fp,1024);
    
    
fputs($fp,"RCPT TO:".$this->direcciones[$i]."\r\n") or ($this->error(6));
    
fgets($fp,1024);

    
fputs($fp,"DATA\r\n") or ($this->error(6));
    
fgets($fp,1024);

    
fputs($fp,"SUBJECT:".$this->asunto[$i]."\r\n.\r\n") or ($this->error(6));
    
fgets($fp,1024);

    
fputs($fp,$this->mensaje[$i]."\r\n.\r\n") or ($this->error(6));
    
fgets($fp,1024);
     }    
    }else{
  
fputs($fp,"MAIL FROM:".$this->remitente."\r\n") or ($this->error(6));
  
fgets($fp,1024);
  
fputs($fp,"RCPT TO:".$this->direcciones."\r\n") or ($this->error(6));
  
fgets($fp,1024);
  
fputs($fp,"DATA\r\n") or ($this->error(6));
  
fgets($fp,1024);
  
fputs($fp,"SUBJECT:".$this->asunto."\r\n.\r\n") or ($this->error(6));
  
fgets($fp,1024);
  
fputs($fp,$this->mensaje."\r\n.\r\n") or ($this->error(6));
  
fgets($fp,1024);
  }
 
fputs($fp,"QUIT\r\n") or ($this->error(6));
 
fgets($fp,1024);
 
fclose($fp) or ($this->error(7));
}
}
//funcion
/***   FIN CLASE ***/
}
?>
hay te dejo una classe, para envio de email, 4 formas de envio
__________________
3w.valenciadjs.com
3w.laislatv.com

Última edición por nuevo; 17/11/2003 a las 03:13
  #3 (permalink)  
Antiguo 17/11/2003, 03:11
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
y las 4 formas de enviar el email

Código PHP:
/*************** Envio simple via funcion mail()**************************/
$a      "Asunto";
$d      "[email protected]";
$m      "Mensaje";
$r      "[email protected]";
$mail   = new email($a,$d,$m,$r);
$mail->enviar();
echo 
$mail->errores();//Si exisiten errores los mostrara
echo $mail->enviado();//Muestra un mensaje al enviar el mail


/*************** Envio multiple via funcion mail()**************************/
$a      = array("Asunto","Asunto2");
$d      = array("[email protected]","[email protected]");
$m      = array("Mensaje","Mensaje2");
$r      = array("[email protected]","[email protected]");
$mail   = new email($a,$d,$m,$r);
$mail->enviar();
echo 
$mail->errores();//Si exisiten errores los mostrara
echo $mail->enviado();//Muestra un mensaje al enviar el mail


/*************** Envio simple via sockets    **************************/
$a      "Asunto";
$d      "[email protected]";
$m      "Mensaje";
$r      "[email protected]";
$server "169.254.62.112";//Ip o nombre, o direccion del servidor SMTP
$port   "25";//El puerto a usar
$mail   = new email($a,$d,$m,$r);
$mail->smtp($server,$port);
//$mail->smtp($server,$port); En caso de no existir login
echo $mail->errores();//Si exisiten errores los mostrara
echo $mail->enviado();//Muestra un mensaje al enviar el mail


/*************** Envio multiple via sockets    **************************/
$a      = array("Asunto","Asunto2");
$d      = array("[email protected]","[email protected]");
$m      = array("Mensaje","Mensaje2");
$r      = array("[email protected]","[email protected]");
$server "169.254.62.112";//Ip o nombre, o direccion del servidor SMTP
$port   "25";//El puerto a usar
$mail   = new email($a,$d,$m,$r);
$mail->smtp($server,$port);
//$mail->smtp($server,$port); En caso de no existir login
echo $mail->errores();//Si exisiten errores los mostrara
echo $mail->enviado();//Muestra un mensaje al enviar el mail 
__________________
3w.valenciadjs.com
3w.laislatv.com
  #4 (permalink)  
Antiguo 17/11/2003, 22:35
 
Fecha de Ingreso: diciembre-2002
Mensajes: 473
Antigüedad: 21 años, 4 meses
Puntos: 0
gracias!!!!

muchas garcias por los mensjes, genial! voy a ver is lo deenuzo!
gracias por el trabajo!
tico
  #5 (permalink)  
Antiguo 18/11/2003, 00:33
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
de nada hombre... tb te digo una cosa... hay classes mejores, que esta, aunq yo la uso desde hace 6 meses y nunca me dio problema, pero he de decir que las hay mejores y con mas cosas, y mas completas..


cheka esta url

http://www.phpclasses.org/

te lo recomiendo
__________________
3w.valenciadjs.com
3w.laislatv.com
  #6 (permalink)  
Antiguo 19/11/2003, 21:21
 
Fecha de Ingreso: diciembre-2002
Mensajes: 473
Antigüedad: 21 años, 4 meses
Puntos: 0
Gracias igual por el script y la mmolestia que te tomaste .
Ya estoy chequeando la url.Un saludo!
Tico


pd:Tambien estuve probando el list messenger ya parece bueno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:26.