Nueva pregunta

Pregunta:

Fecha: 20-11-2015 18:46:04 (En Español)

Alguna Libreria para descargar email IMAP y POP3?[Resuelta]

Hola a todos

En esta oportunidad queria consultarles que libreria pudo utilizar y que este bien documentada para ser utilizada para descargar emails por medio de los protocolos IMAP y POP3, ya sea una cuenta de gmail y otras.

Que permita obtener, el asunto, quien lo envía, si tiene copia a otros destinatarios, el mensaje, las imágenes incrustada en el mensaje y la posibilidad de descargar los adjuntos.

Que distinga mails leídos de los no leídos.

Que se pueda utilizar criterios o filtros por ejemplo listar los mails del día actual que no fueron leídos.
Listar mails, buzones, etc

Se que se puede hacer con funciones nativas del lenguaje de PHP sea
IMAP IMAP, POP3 y NNTP
He estado viendo un poco sobre las funciones nativas y hay apartado con escasa información.

También se podría usar la libreria PHPMailer aunque no he encontrado información al respecto.

Que sea facil de entender y de utilizar.
Que me recomiendan?

Muchas gracias por la atención.

Saludos.-
Etiquetas: Clase PHP - Email - IMAP - Librería - NNTP - PHP - PHPMailer - POP3 - Pregunta Votos: 1 - Respuestas: 9 - Vistas: 21 Compartir en: Google Facebook Twitter LinkedIn Link
 

Respuestas:

  • Fecha: 20-11-2015 23:49:31 Hola Walter:

    Yo vengo utilizando desde hace años Thunderbird

    Es del grupo Mozila (el mismo que Firefox) y tiene abundante documentación.

    Ya va por la versión 38.3.0.

    EDITO: para Gmail puedes revisar https://support.mozilla.org/en-US/kb/thunderbird-and-gmail, Personalmente lo abro con Chome ya que Google se ha vuelto muy sensible (y Gmail utiliza cookies). Pero si lo quieres, se puede.
      Votos: 1 - Link respuesta
     
  • Fecha: 21-11-2015 08:13:52 Artzain gracias por tu respuesta, he utilizado al Thunderbird como gestor de correo electrónico, es un programa al estilo Outlook, etc

    Lo que busco es descargar los correos por medio de PHP.

    Expongo a modo de ejemplo el cual he usado:

    imap_check.php

    HTML> 
        <HEAD> 
            <TITLE>imap check</TITLE> 
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        </HEAD> 
        <BODY> 
            <?php
    
    
            set_time_limit(4000);
    
    include_once 'imapconfig.php'; // Configuracion de hostname,username, password
    
    
    
    // try to connect
            $inbox = imap_open($hostname, $username, $password) or die('Cannot connect to Gmail: ' . imap_last_error());
    
            /* ALL - return all messages matching the rest of the criteria
              ANSWERED - match messages with the \\ANSWERED flag set
              BCC "string" - match messages with "string" in the Bcc: field
              BEFORE "date" - match messages with Date: before "date"
              BODY "string" - match messages with "string" in the body of the message
              CC "string" - match messages with "string" in the Cc: field
              DELETED - match deleted messages
              FLAGGED - match messages with the \\FLAGGED (sometimes referred to as Important or Urgent) flag set
              FROM "string" - match messages with "string" in the From: field
              KEYWORD "string" - match messages with "string" as a keyword
              NEW - match new messages
              OLD - match old messages
              ON "date" - match messages with Date: matching "date"
              RECENT - match messages with the \\RECENT flag set
              SEEN - match messages that have been read (the \\SEEN flag is set)
              SINCE "date" - match messages with Date: after "date"
              SUBJECT "string" - match messages with "string" in the Subject:
              TEXT "string" - match messages with text "string"
              TO "string" - match messages with "string" in the To:
              UNANSWERED - match messages that have not been answered
              UNDELETED - match messages that are not deleted
              UNFLAGGED - match messages that are not flagged
              UNKEYWORD "string" - match messages that do not have the keyword "string"
              UNSEEN - match messages which have not been read yet */
    
    // search and get unseen emails, function will return email ids
    
            $emails = imap_search($inbox, 'UNSEEN');
    
    rsort($emails);
    
            $output = '';
    
            foreach ($emails as $mail) {
                $headerInfo = imap_headerinfo($inbox, $mail);
                $output .= "<b>ASUNTO: </b>" . imap_utf8(utf8_decode($headerInfo->subject)) . '<br/>';
                $output .= "<b>A: </b>" . imap_utf8(utf8_decode($headerInfo->toaddress )). '<br/>';
                $output .= "<b>FECHA: </b>" . $headerInfo->date . '<br/>';
                $output .= "<b>DE: </b>" . $headerInfo->fromaddress . '<br/>';
                $output .= "<b>COPIA A: </b>" . $headerInfo->reply_toaddress . '<br/>';
    
                $emailStructure = imap_fetchstructure($inbox, $mail);
                if (!isset($emailStructure->parts)) {
                    $output .= "<b>MENSAJE: </b><br/>" . nl2br(utf8_encode(quoted_printable_decode(imap_body($inbox, $mail, FT_PEEK))));
                } 
    //            else {
    //            
    //                $output .= "[SIN MENSAJE]";
    //                    $output .= "<HR/>";
    //                echo $output;
    //                 $output = '';
    //            }
                $output .= "<HR/>";
                echo $output;
                $output = '';
            }
    
    // colse the connection
            imap_expunge($inbox);
            imap_close($inbox);
            ?>
    
        </BODY></HTML>
    


    imapconfig.php
    <?php
    // Usando GMAIL puede ser cualquier dominio
           $hostname = '{imap.gmail.com:993/imap/ssl}';
           $username = 'usuario@gmail.com';
           $password = 'MiPassword';
    


    Por lo que he observado hay un problema en el codigo es que le body del mail el mensaje tienen distintas codificaciones y por ahí algunos no son legibles por lo tanto hay que decodificarlo segun sea su codificación,es para investigar.

    Ando buscando algo como eso

    Muchas gracias

    Saludos
      Votos: 1 - Link respuesta
     
  • Fecha: 21-11-2015 09:24:05 Encontré algo de información interesante.

    http://php.net/manual/es/book.imap.php

    http://php.net/manual/es/function.imap-body.php
    Simple example on how to read body message of the recent mail. 
    
    <?php 
    $imap = imap_open("{pop.example.com:995/pop3/ssl/novalidate-cert}", "username", "password"); 
    
    if( $imap ) { 
        
         //Check no.of.msgs 
         $num = imap_num_msg($imap); 
    
         //if there is a message in your inbox 
         if( $num >0 ) { 
              //read that mail recently arrived 
              echo imap_qprint(imap_body($imap, $num)); 
         } 
    
         //close the stream 
         imap_close($imap); 
    } 
    ?>
    
      Votos: 2 - Link respuesta
     
  • Fecha: 21-11-2015 10:49:01 Mauricio muchas gracias por tu respuesta
    Voy a probarlo.
    Seguiré investigando e iré publicando las novedades.
      Votos: 0 - Link respuesta
     
  • Fecha: 21-11-2015 11:39:11 Listo gracias, buen dia   Votos: 0 - Link respuesta
     
  • Fecha: 26-11-2015 12:42:40 Yo hice un tutorial de eso: http://hdeleon.net/como-obtener-los-correos-de-una-cuenta-de-gmail-con-php-imap/   Votos: 2 - Link respuesta
     
  • Fecha: 26-11-2015 12:43:20 Si deseas descargar adjuntos te hago un post, yo hice una aplicación que baja 500 mensajes de gmail diarios junto a sus adjuntos y funcionando.   Votos: 2 - Link respuesta
     
  • Fecha: 26-11-2015 13:20:24 Buenisimo
    Si podes hacer un post en la comunidad sobre lo que planteas sería genial.
    Un gran aporte para todos.
    Luego deja el link aquí
    Muchas gracias
    Saludos
      Votos: 1 - Link respuesta
     
  •  
Para participar activamente de la comunidad primero debes autenticarte, ingresa al sistema.Iniciar Sesión
 
frjcbbae garagebible.com