Smiling Souls

Steeped in the delicious tea like leaves of anthroposophy for the evolving soul.


The Mail_IMAP::$header property is available by calling on Mail_IMAP::getHeaders(). It provides information from the message headers of a multipart message. The available headers vary depending on whether the headers are from the message itself or from a message attached to that message. The information from the headers are set up in a multidimensional array.

Like other Mail_IMAP properties, the first level of nesting in this property's array is offset by message number. For instance, the subject of a message is available as $header[$mid]['subject'], where $mid is the message id. Addresses are split into an additional sub-nesting offset by the address count. For example, $header[$mid]['to'][$n], $n refers to the address count.

The information available in the Mail_IMAP::$header property may vary from message to message and from server to server. The raw message headers are kept in the Mail_IMAP::$header under the 'raw' indice as Mail_IMAP::$header[$mid]['raw']. This indice is only available when calling on Mail_IMAP::getRawHeaders() with the $rtn argument set to FALSE.

Note: The contents of the Mail_IMAP::$header property can be retrieved by calling on Mail_IMAP::getHeaders() with the $rtn argument set to TRUE.

The possible indices of the Mail_IMAP::$header property are outlined in the following table. Most of the following was taken directly from the PHP documentation for imap_headerinfo(). The only major differences are; Mail_IMAP makes additional indices available such as complete addresses, instead of the addresses being broken down by mailbox and host, and Mail_IMAP attempts to always provide a UNIX timestamp in the udate indice regardless of whether the message headers are provided by imap_headerinfo() or imap_rfc822_parse_headers() (the latter is used to parse headers of attached messages and provides less information than the former).

Associative Indice Data type Purpose
str The message subject line.
fetchsubject str Contains the subject line formatted to fit the length specified in $subject_length (1024 characters by default).

$subject_length refers to an optional argument for imap_headerinfo(), which can be specified in the $args argument of Mail_IMAP::getHeaders()

str Pre-formated date string.
udate int The date the message was received in Unix time. See the date() function.
in_reply_to str Information from the 'In reply to' line, if any.
message_id int The message id.
newsgroups str Information from the 'Newsgroups' line, if any.
followup_to str Information from the 'Follow up to' line, if any.
references str Information from the 'References' line, if any.
Recent str Recent flag.** ('R' for recentand seen, 'N' if recent and not seen, '' if not recent)
Unseen str Unseen flag.** ('U' if not seen and not recent, '' if seen or not seen and recent)
Answered str Answered flag.** ('A' if answered, '' if not answered)
Deleted str Deleted flag.** ('D' if deleted, '' if not deleted)
Draft str Draft flag.** ('X' if draft, '' if not draft)
Flagged str Flagged flag.** ('F' if flagged, '' if not flagged)
Note: Recent/Unseen behavior is a little odd. If you want to know if a message is Unseen, you must check for:

Unseen == 'U' || Recent == 'N'

** POP3 Mailboxes don't remember flag settings between connections.
fromaddress str Full 'from' line (up to 1024 characters).
fetchfrom str Full 'from' line formatted to fit $from_length.
from str Individual complete 'from' address(es).
from_personal str Individual 'from' personal information.
from_mailbox str Individual 'from' mailbox(es).
from_host str Individual 'from' host(s).
senderaddress str Full 'sender' line (up to 1024 characters).
sender str Individual complete 'sender' address(es).
sender_personal str Individual 'sender' personal information.
sender_mailbox str Individual 'sender' mailbox(es).
sender_host str Individual 'sender' host(s).
reply_toaddress str Full 'reply to' line (up to 1024 characters).
reply_to str Individual complete 'reply to' address(es).
reply_to_personal str Individual 'reply to' personal information.
reply_to_mailbox str Individual 'reply to' mailbox(es).
reply_to_host str Individual 'reply to' host(s).
return_path str Full 'return path' line (up to 1024 characters).
toaddress str Full 'to' line (up to 1024 characters).
to str Individual 'to' addresses.
to_personal str Individual 'to' personal information.
to_mailbox str Individual 'to' mailbox(es).
to_host str Individual 'to' host(s).
ccaddress str Full 'cc' line (up to 1024 characters).
cc str Individual 'cc' addresses.
cc_personal str Individual 'cc' personal information.
cc_mailbox str Individual 'cc' mailbox(es).
cc_host str Individual 'cc' host(s).
bccaddress str Full 'bcc' line (up to 1024 characters).
bcc str Individual 'bcc' addresses.
bcc_personal str Individual 'bcc' personal information.
bcc_mailbox str Individual 'bcc' mailbox(es).
bcc_host str Individual 'bcc' host(s).


There are no comments posted at this time.

Leave a Comment

Simple HTML is allowed: <code>, <b>, <i>, <u>, <var>, <strong>, <em>, <blockquote>, <ul>, <ol>, <li>, <p> (no attributes). All spacing and line breaks in your comment will be preserved.

* All comments are moderated and are subject to approval.
Your comment will appear once it has been approved.
Posting multiple times will not expedite the approval process.

Comments are closed at this time.

© Copyright 2015 Hot Toddy, All Rights Reserved.