Dutch PHP Conference 2019


(PHP 4, PHP 5, PHP 7)

imap_headersRetourne les en-têtes de tous les messages d'une boîte aux lettres


array imap_headers ( resource $imap_stream )

Retourne les en-têtes de tous les messages d'une boîte aux lettres.

Liste de paramètres


Un flux IMAP retourné par la fonction imap_open().

Valeurs de retour

Retourne un tableau de chaînes contenant les en-têtes des messages : une chaîne par message.

add a note add a note

User Contributed Notes 4 notes

paulwright75 at hotmail dot com
5 years ago
Ok, this page is driving me crazy. Parsing the lines returned in the array is simple enough but there is no definitions on what the flags mean. So I searched the web to find the answer and this is what I was able to gather:

A - Answered: email has been replied to
N - New: Recent and not seen
R - Recent: Recent and seen
U - Unread: The message has not been read yet
F - Flagged: Message is "flagged" for urgent/special attention
D - Deleted: Message is "deleted" for removal by later EXPUNGE
X - Draft: Message has not completed composition (marked as a draft).

please correct me if I am wrong...
antispam at katiheta dot net
5 years ago
Message flag descriptions can be found on official imap_headerinfo page (http://www.php.net/manual/en/function.imap-headerinfo.php) in "Return Value" paragraph.
webmaster at RealityRipple dot com
6 months ago
Just a helpful hint, many IMAP servers will include non-standard flags in curly braces before the subject in the response of this function. Pretty sure this is the only way to determine if a message has been forwarded, for example, when using the IMAP functions. The first flag (or more) may be prefixed with a dollar sign ($). It's (probably) likely that any such flags received by a server can be passed through imap_append to that server, as well.
mmuoio at gmail dot com
9 years ago
This function will not return a full subject line if it is longer than 25 characters.  I found this out after trying to search each header and move the email to a different folder depending on what the subject was (searching for year and project number).
To Top