(PHP 4, PHP 5)

imap_headersReturns headers for all messages in a mailbox


array imap_headers ( resource $imap_stream )

Returns headers for all messages in a mailbox.

Список параметров


Поток IMAP, полученный из imap_open().

Возвращаемые значения

Returns an array of string formatted with header info. One element per mail message.


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).
2009-10-12 13:39:45
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...
2013-06-18 03:54:05
Message flag descriptions can be found on official imap_headerinfo page (function.imap-headerinfo) in "Return Value" paragraph.
2013-07-31 17:44:48
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.
2018-05-06 14:32:21

    Поддержать сайт на родительском проекте КГБ