IMAP Functions

These functions are used to communicate with mail and news servers via the IMAP4, POP3, or NNTP protocols. For these functions to work, you have to compile PHP with map. That requires the C-client library to be installed. You can get the latest version from and compile it.

string imap_8bit(string text)

Convert an 8-bit string to a quoted-printable string

int imap_append(int stream_id, string folder, string message [, string flags])

Append a string message to a specified mailbox

string imap_base64(string text)

Decode base-64-encoded text

string imap_binary(string text)

Convert an 8-bit string to a base-64-encoded string

string imap_body(int stream_id, int msg_no [, int options])

Read the message body

object imap_bodystruct(int stream_id, int msg_no, int section)

Read the structure of a specified body section of a specific message

object imap_check(int stream_id)

Get mailbox properties

void imap_clearflag_full(int stream_id, string sequence, string flag [, int options])

Clear flags on messages

int imap_close(int stream_id [, int options])

Close an IMAP stream

int imap_create(int stream_id, string mailbox)

An alias for imap_createmailbox

int imap_createmailbox(int stream_id, string mailbox)

Create a new mailbox

int imap_delete(int stream_id, int msg_no)

Mark a message for deletion

bool imap_deletemailbox(int stream_id, string mailbox)

Delete a mailbox

int imap_expunge(int stream_id)

Delete all messages marked for deletion

array imap_fetch_overview(int ...

Get Webmaster in a Nutshell, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.