Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

Use imap_errors to get an array of all errors generated by IMAP functions, removing
them from an internal stack. You can use imap_last_error to get just the last error.


boolean imap_expunge(integer stream)


Use imap_expunge to remove all messages marked for deletion.


<?


//expunge messages
$mailbox = imap_open("{mail.server.com}INBOX",
"leon", "password");
imap_expunge($mailbox);
imap_close($mailbox);
?>


array imap_fetch_overview(integer stream, integer message)


The imap_fetch_overview function returns an array that gives an overview of a
message's headers. The array contains the following elements: answered, date,
deleted, draft, flagged, from, message_id, msgno, recent,
references, seen, size, subject, uid.


string imap_fetchbody(integer stream, integer message,
integer part, integer flags)


The imap_fetchbody function gets a specific part of a message. The body parts are
encoded in base64 and must be passed through imap_base64 to be viewed as clear


text. The flags argument accepts the flags described in Table 14.2.


<?


// get first part of first message
$mailbox=imap_open("{mail.server.com}INBOX", "leon",
"password");
$part1 = imap_fetchbody($mailbox, 1, 1);
imap_close($mailbox);
?>


string imap_fetchheader(integer stream, integer message,
integer flags)

Free download pdf