Please note that the UID is NOT unique.
UID of the email may be not unique on the server (2 messages in different folders may have same UID).
Basically, don't use the UID as a unique identifier.
(PHP 4, PHP 5, PHP 7, PHP 8)
imap_body — Leer el cuerpo del mensaje
$imap_stream
, int $msg_number
, int $options
= 0): string
imap_body() devuelve el cuerpo del mensaje,
numerado por msg_number
en el buzón
actual.
imap_body() sólo devolverá una copia palabra por palabra del cuerpo del mensaje. Para extraer partes simples de un mensaje multiparte codificado mediante MIME tiene que usar imap_fetchstructure() para analizar su estructura y imap_fetchbody() para extraer una copia de un componente simple del cuerpo.
imap_stream
IMAP stream devuelto por imap_open().
msg_number
El número de mensaje
options
El parámetro opcional options
es una máscara de bits
con uno o más de lo siguiente:
FT_UID
- msg_number
es un UID
FT_PEEK
- No establece la bandera \Seen si no lo está ya
FT_INTERNAL
- La cadena devuelta está en formato interno,
no se canonizará a CRLF.
Devuelve el cuerpo del mensaje especificado, como cadena.
Please note that the UID is NOT unique.
UID of the email may be not unique on the server (2 messages in different folders may have same UID).
Basically, don't use the UID as a unique identifier.
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);
}
?>