Funciones IMAP, POP3 y NNTP

LIX. Funciones IMAP, POP3 y NNTP

Introducci贸n

Estas funciones no se encuentran limitadas al protocolo IMAP, a pesar de su nombre. La biblioteca c-client interna tambi茅n soporta m茅todos de acceso a NNTP, POP3 y buzones de correo locales.

Requisitos

Esta extensi贸n requiere que la biblioteca c-client se encuentre instalada. Obtenga la versi贸n m谩s reciente de ftp://ftp.cac.washington.edu/imap/ y comp铆lela.

Es importante que no copie los archivos fuente IMAP directamente al directorio de inclusiones del sistema ya que puede crear conflictos. En su lugar, cree un nuevo directorio al interior del directorio de inclusiones del sistema, tal como /usr/local/imap-2000b/ (la ubicaci贸n y nombre dependen de su configuraci贸n y versi贸n de IMAP), y al interior de este directorio nuevo cree los directorios adicionales con nombres lib/ e include/. Desde el directorio c-client de su 谩rbol de fuentes IMAP, copie todos los archivos *.h en include/ y todos los *.c en lib/. Adicionalmente, cuando haya compilado IMAP, un archivo llamado c-client.a es creado. Coloque tambi茅n este archivo en el directorio lib/, pero cambie su nombre a libc-client.a.

Nota: Para compilar la biblioteca c-client con soporte SSL o Kerberos, lea la documentaci贸n que viene con el paquete.

Nota: En Mandrake Linux, la biblioteca IMAP (libc-client.a) es compilada sin soporte para Kerberos. Una versi贸n aparte con SSL (client-PHP4.a) es instalada. La biblioteca debe ser recompilada para agregar soporte Kerberos.

Instalaci贸n

To get these functions to work, you have to compile PHP with --with-imap[=DIR], where DIR is the c-client install prefix. From our example above, you would use --with-imap=/usr/local/imap-2000b. This location depends on where you created this directory according to the description above. Windows users may include the php_imap.dll DLL in php.ini. IMAP is not supported on systems earlier that Windows 2000. This is because it uses encryption functions in order to enable SSL connections to the mail servers.

Nota: Depending how the c-client was configured, you might also need to add --with-imap-ssl=/path/to/openssl/ and/or --with-kerberos=/path/to/kerberos into the PHP configure line.

Aviso

La extensi贸n IMAP no puede ser usada junto con las extensiones recode, YAZCyrus. Esto es debido a que las dos utilizan el mismo s铆mbolo interno

Configuraci贸n en tiempo de ejecuci贸n

Esta extensi贸n no tiene directivas de configuraci贸n en php.ini.

Constantes predefinidas

Estas constantes est谩n definidas por esta extensi贸n y estar谩n disponibles solamente cuando la extensi贸n ha sido o bien compilada dentro de PHP o grabada din谩micamente en tiempo de ejecuci贸n.

NIL (integer)

OP_DEBUG (integer)

OP_READONLY (integer)

Open mailbox read-only

OP_ANONYMOUS (integer)

Don't use or update a .newsrc for news (NNTP only)

OP_SHORTCACHE (integer)

OP_SILENT (integer)

OP_PROTOTYPE (integer)

OP_HALFOPEN (integer)

For IMAP and NNTP names, open a connection but don't open a mailbox.

OP_EXPUNGE (integer)

OP_SECURE (integer)

CL_EXPUNGE (integer)

silently expunge the mailbox before closing when calling imap_close()

FT_UID (integer)

The parameter is a UID

FT_PEEK (integer)

Do not set the \Seen flag if not already set

FT_NOT (integer)

FT_INTERNAL (integer)

The return string is in internal format, will not canonicalize to CRLF.

FT_PREFETCHTEXT (integer)

ST_UID (integer)

The sequence argument contains UIDs instead of sequence numbers

ST_SILENT (integer)

ST_SET (integer)

CP_UID (integer)

the sequence numbers contain UIDS

CP_MOVE (integer)

Delete the messages from the current mailbox after copying with imap_mail_copy()

SE_UID (integer)

Return UIDs instead of sequence numbers

SE_FREE (integer)

SE_NOPREFETCH (integer)

Don't prefetch searched messages

SO_FREE (integer)

SO_NOSERVER (integer)

SA_MESSAGES (integer)

SA_RECENT (integer)

SA_UNSEEN (integer)

SA_UIDNEXT (integer)

SA_UIDVALIDITY (integer)

SA_ALL (integer)

LATT_NOINFERIORS (integer)

This mailbox has no "children" (there are no mailboxes below this one).

LATT_NOSELECT (integer)

This is only a container, not a mailbox - you cannot open it.

LATT_MARKED (integer)

This mailbox is marked. Only used by UW-IMAPD.

LATT_UNMARKED (integer)

This mailbox is not marked. Only used by UW-IMAPD.

SORTDATE (integer)

Sort criteria for imap_sort(): message Date

SORTARRIVAL (integer)

Sort criteria for imap_sort(): arrival date

SORTFROM (integer)

Sort criteria for imap_sort(): mailbox in first From address

SORTSUBJECT (integer)

Sort criteria for imap_sort(): message subject

SORTTO (integer)

Sort criteria for imap_sort(): mailbox in first To address

SORTCC (integer)

Sort criteria for imap_sort(): mailbox in first cc address

SORTSIZE (integer)

Sort criteria for imap_sort(): size of message in octets

TYPETEXT (integer)

TYPEMULTIPART (integer)

TYPEMESSAGE (integer)

TYPEAPPLICATION (integer)

TYPEAUDIO (integer)

TYPEIMAGE (integer)

TYPEVIDEO (integer)

TYPEOTHER (integer)

ENC7BIT (integer)

ENC8BIT (integer)

ENCBINARY (integer)

ENCBASE64 (integer)

ENCQUOTEDPRINTABLE (integer)

ENCOTHER (integer)

Ver tambi茅n

Este documento no puede entrar en detalles sobre todos los temas que involucran lan funciones ofrecidas. Puede encontrar m谩s informaci贸n en la documentaci贸n de las fuentes de la biblioteca c-client (docs/internal.txt), y en los siguientes documentos RFC:

  • RFC2821: Protocolo Simple de Transferencia de Correo (SMTP).

  • RFC2822: Est谩ndar para los mensajes de texto en internet ARPA.

  • RFC2060: Protocolo de Acceso de Mensaje de Internet (IMAP) Versi贸n 4rev1.

  • RFC1939: Protocolo Post Office Versi贸n 3 (POP3).

  • RFC977: Protocolo de Transferencia de Noticias en Red (NNTP).

  • RFC2076: Cabeceras de Mensajes de Internet Comunes.

  • RFC2045 , RFC2046 , RFC2047 , RFC2048 & RFC2049: Extensiones de Correo de Internet Multi-prop贸sito (MIME).

Una vista general detallada se encuentra disponible tambi茅n en los libros Programming Internet Email por David Wood y Managing IMAP por Dianna Mullet y Kevin Mullet.

Tabla de contenidos
imap_8bit --  Convierte una cadena de 8bit a una cadena quoted-printable
imap_alerts --  Esta funci贸n devuelve todos los mensajes de alerta IMAP (si hubo) que han ocurrido durante la petici贸n de la pagina o desde que la pila de alertas fue inicializada.
imap_append --  Agrega una cadena de mensaje al buz贸n especificado
imap_base64 -- Decodifica texto codificado en BASE64
imap_binary --  Convierte una cadena de 8bit a una cadena base64
imap_body -- Lee el cuerpo del mensaje
imap_bodystruct --  Read the structure of a specified body section of a specific message
imap_check -- Comprueba el estado del buz贸n actual
imap_clearflag_full -- Limpia los flags de los mensajes
imap_close -- Cierra una sesi贸n IMAP
imap_createmailbox -- Crea un buz贸n nuevo
imap_delete --  Marca un mensaje para ser borrado en el buz贸n actual
imap_deletemailbox -- Elimina un buz贸n
imap_errors --  Esta funci贸n devuelve todos los errores IMAP (si hubo) que han occurrido durante la petici贸n de la p谩gina o desde que la pila de errores se inicializ贸.
imap_expunge -- Elimina todos los mensajes marcados como borrados
imap_fetch_overview --  Read an overview of the information in the headers of the given message
imap_fetchbody -- Localiza una secci贸n particular en el cuerpo del mensaje
imap_fetchheader -- Devuelve la cabecera de un mensaje
imap_fetchstructure --  Lee la estructuta de un mensaje concreto
imap_get_quota --  Retrieve the quota level settings, and usage statics per mailbox
imap_get_quotaroot --  Retrieve the quota settings per user
imap_getacl --  Gets the ACL for a given mailbox
imap_getmailboxes --  Lee la lista de buzones, devolviendo informac贸n detallada de cada uno
imap_getsubscribed -- Lista todos los buzones subscritos
imap_header -- Lee la cabecera del mensaje
imap_headerinfo -- Read the header of the message
imap_headers --  Returns headers for all messages in a mailbox
imap_last_error --  Esta funci贸n devuelve el 煤ltimo error IMAP (si se produjo) que ocurri贸 durante la petici贸n de esta p谩gina.
imap_list -- Read the list of mailboxes
imap_listmailbox -- Lee la lista de buzones
imap_listscan --  Read the list of mailboxes, takes a string to search for in the text of the mailbox
imap_listsubscribed -- Lista todos los buzones subscritos
imap_lsub -- List all the subscribed mailboxes
imap_mail_compose --  Create a MIME message based on given envelope and body sections
imap_mail_copy -- Copia los mensajes especificados a un buz贸n
imap_mail_move -- Mueve los mensajes especificados a un buz贸n
imap_mail --  Send an email message
imap_mailboxmsginfo -- Obtiene informaci贸n acerca del buz贸n actual
imap_mime_header_decode -- Decode MIME header elements
imap_msgno --  Esta funci贸n devuelve el n煤mero de secuencia del mensaje para el UID dado.
imap_num_msg --  Informa del n煤mero de mensajes en el buz贸n actual
imap_num_recent -- Informa el n煤mero de mensajes recientes en el buz贸n actual
imap_open -- Abre una sesi贸n IMAP
imap_ping -- Comprueba si la sesi贸n IMAP est谩 a煤n activa
imap_qprint -- Convierte una cadena quoted-printable a una cadena de 8 bit
imap_renamemailbox -- Renombra un buz贸n
imap_reopen -- Reabre una sesi贸n IMAP a un nuevo buz贸n
imap_rfc822_parse_adrlist -- Examina la cadena direcci贸n
imap_rfc822_parse_headers -- Parse mail headers from a string
imap_rfc822_write_address --  Devuleve una direcci贸n de correo correctamente formateada dado el buz贸n, host, e informaci贸n personal.
imap_scanmailbox --  Lee la lista de buzones y toma una cadena para buscar en el texto del buz贸n
imap_search --  Esta funci贸n devuelve un array de mensajes que coinciden con el criterio de busqueda dado.
imap_set_quota -- Sets a quota for a given mailbox
imap_setacl --  Sets the ACL for a giving mailbox
imap_setflag_full -- Activa flags en los mensajes
imap_sort -- Ordena un array de cabeceras de mensajes
imap_status --  Esta funci贸n devuelve el informaci贸n de estado de otro buz贸n distinto al actual.
imap_subscribe -- Subscribe to a mailbox
imap_thread --  Returns a tree of threaded message
imap_timeout --  Set or fetch imap timeout
imap_uid --  Esta funci贸n devuelve el UID del n煤mero de secuencia del mensaje dado
imap_undelete --  Desmarca los mensajes que est谩n marcados como borrados
imap_unsubscribe -- Unsubscribe from a mailbox
imap_utf7_decode --  Decodes a modified UTF-7 encoded string
imap_utf7_encode --  Converts ISO-8859-1 string to modified UTF-7 text
imap_utf8 --  Converts MIME-encoded text to UTF-8