Foros del Web » Programando para Internet » PHP » Symfony »

problemas con imap y symfony

Estas en el tema de problemas con imap y symfony en el foro de Symfony en Foros del Web. hola señores: tengo una duda con erspecto al rendimiento de symfony estoy desarrollando un lector de correos para servidor imap, pero despues de mucho leer ...
  #1 (permalink)  
Antiguo 28/08/2008, 17:08
Avatar de rockobop  
Fecha de Ingreso: octubre-2004
Ubicación: Bolivia
Mensajes: 826
Antigüedad: 19 años, 6 meses
Puntos: 1
problemas con imap y symfony

hola señores:

tengo una duda con erspecto al rendimiento de symfony

estoy desarrollando un lector de correos para servidor imap, pero despues de mucho leer y probar escribi un codigo que segun es de lo mas completo y sencillo, pero tengo varios problemas

***** puedo leer archivos de 5kb con html pero no leo correos de texto de 3Kb ¿?
***** puedo leer algunos correos de 1-2 Kb de texto de todos los servidores de correo, pero no otros ¿?
***** si falla en la lectura de alguno de los correos, ya no puedo abrir ningun otro inclusive alguno q haya abierto anteriormente, a no ser q habra en otro navegador

es por eso q llegue a pensar q quizas pueda ser algo de symfony q pueda llegar a estar afectando el rendimiento de mi aplicacion

este es el codigo de acction
Código PHP:
public function executeLeer()
  {
        
set_time_limit(1200);
          
        
//$this->id=$this->getUser()->getAttribute('idUsuario');
        //$this->usuario=UsuarioPeer::retrieveByPK($this->id);
        
        
$password=$this->getUser()->getAttribute('passwordCorreo');
        
$login=$this->devolverLogin();
      
        
$this->param $this->getRequestParameter('mensaje');
        
        
$imap=$this->conectarServidor($login,$password);
              
        
$header imap_header($imap,  $this->param);
         
          
      
if  (isset (
$header->subject)){
            
$subject=$header->subject;}
    else { 
$subject="Sin Asunto"; }
  
$this->subject$subject;
  

if  (isset (
$header->from)){
    
$from=$header->from;
        foreach (
$from as $id => $object) {
            if  (isset (
$object->personal)){
            
$fromname $object->personal;}
            else { 
$fromname=" "; }
        
            if  (isset (
$object->mailbox)){
            
$fromaddress $object->mailbox "@" $object->host;}
            else { 
$fromaddress=" "; }
        }    
    }else { 
$from="Sin Destinatario";
             
$fromname="Sin Nombre";
            
$fromaddress="Sin Direccion";}
  
$this->fromname=$fromname;
  
$this->fromaddress=$fromaddress;

if  (isset (
$header->cc)){
    
$cc=$header->cc;
        foreach (
$cc as $id => $object) {
            if  (isset (
$object->mailbox)){
            
$copiacc[] = $object->mailbox "@" $object->host;}
            else{
$copiacc[] =" ";}       
        }
    }else { 
$cc=" ";
            
$copiacc[] =" "; }
  
$this->copiacc=$copiacc;
  
$this->cc=$cc;

  
/*if  (isset ($header->reply_to)){
      $reply_to=$header->reply_to;
                  foreach ($reply_to as $id => $object) {
                  if (isset($object->mailbox)){
                    $reply[] = $object->mailbox . "@" . $object->host;
                    }
                  }
      }
      else { $reply_to=" "; }
  $this->reply=$reply;
  $this->retpy_to=$reply_to;*/
  
  
if  (isset ($header->to)){
              
$to=$header->to;
      }else { 
$to=" "; }
  
$this->to=$to;

  
  
  if  (isset (
$header->Date)){
    
$fecha=$header->Date;}
        
  else { 
$fecha="0000-00-00"; }

  
$this->fecha$fecha;

  foreach (
$to as $id => $object) {
      
$to_address[] = $object->mailbox "@" $object->host.", ";
    }
  
$this->to_address=$to_address;
  
  
  
  
$structure imap_fetchstructure($imap$this->param); // structure

if  (isset ($structure->parts)){
        
//print_r($structure->parts);
        
      
$parts $structure->parts;
      
$numparts count($parts);
        
//print_r($numparts);
    
}else{$numparts=0;}
             
        if (
$numparts 1// yes we do
        
{
            
$endwhile false;
            
$stack = array();
            
$content "";
            
$attachment = array();
            
$i 0;
            
            
// for every attachment
            
while (!$endwhile)
            {
                if (!
$parts[$i])
                {
                    if (
count($stack) > 0// have stacks?
                    
// sure we do!
                        
$parts $stack[count($stack) - 1]["p"];
                        
$i $stack[count($stack) - 1]["i"] + 1;
                        
array_pop($stack);
                    } else { 
// or no...
                        
$endwhile true;
                    }
                }
                
                if (!
$endwhile// last loop?
                
{
                    
$partstring "";
                    
                    foreach (
$stack as $s)
                        
$partstring .= ($s["i"] + 1) . ".";
                        
                    
$partstring .= ($i+1);
                    if  (isset (
$parts[$i]->disposition)){
            if (
$parts[$i]->disposition == "attachment"// attachment!!
            
{
                
$attachment[] = array(
                
"filename" => $parts[$i]->parameters[0]->value// filename
                
"encoding" => $parts[$i]->encoding// encodign
                
"filedata" => imap_fetchbody($imap$this->param$partstring// data, duhh!
                
);
            } elseif (
$parts[$i]->subtype == "plain") { // message
                        
$np imap_fetchbody($imap$this->param$partstring); // parse
                        
$content .= nl2br($np); // add this part
            
            
}
            
$content =Util::decode_utf8($content);
                        
$this->content=$content;
            }
                }
                if  (isset (
$parts[$i]->parts)){
            if (
$parts[$i]->parts)
            {
                
$stack[] = array("p" => $parts"i" => $i); // next stack
                
$parts $parts[$i]->parts// parts
                
$i 0;
            } else {
                
$i++;
            }
        }
            }
        } else { 
// no attachments
            
$attachment = array();
            
$content imap_body($imap$this->param);
        
$content nl2br($content);
        
$content =Util::decode_utf8($content);
        
$this->content=$content;
        }
  
  if  (isset (
$structure->parts)){
    
$numparts count($structure->parts);
    
$i=0;
    if (
$numparts >1)
    {
       if  (isset (
$structure->parts)){
        foreach (
$structure->parts as $part)
        {
              if (
$part->disposition == "attachment")
          {
            
print_r($part->disposition);
            
$i++;
            
$this->i=$i;
            
$this->adjunto=$part->dparameters[0]->value;
              }
        }
       }
    }
  }




gracias por sus respuestas

saludos
__________________
:pensando: Tú no necesitas un libro mágico, un gurú carismático, rituales primitivos. Sólo necesitas tus cinco sentidos.:adios:
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 16:32.