DMail Milestone 1.0
Drupal Mail Client
IMAP Class Reference

Public Member Functions

 __construct ($user, $pass, $host=NULL, $port=NULL, $service=NULL, $mb_delim=NULL, $encrypt_mode=NULL, $validate_cert=NULL, $readonly=NULL)
 __destruct ()
 __set ($param, $value)
 open ($mode=0, $force=FALSE)
 close ()
 check ($mbox_name=NULL)
 status ($mbox_name=NULL, $options=SA_ALL)
 fetch_overview ($messages, $mbox_name=NULL)
 list_headers ($mbox_name)
 delete_item ($msgno)
 copy_item ($msgno, $to_folder)
 move_item ($msgno, $to_folder)
 expunge ($mbox_name=NULL)
 headerinfo ($msgno)
 fetchheader ($msgno)
 fetchstructure ($msgno)
 bodystruct ($msgno, $partno)
 list_mbox ($mbox)
 list_mboxes ()
 fetch_item ($msgno, $mime_part= 'TEXT/PLAIN', $parts=NULL)

Protected Attributes

 $host = 'localhost'
 $port = 143
 $service = 'imap'
 $encrypt = 'none'
 $validate = FALSE
 $mbdelim = '.'
 $mbuser = array('user' => 'mbuser', 'pass' => 'mbpass')
 $mbreadonly = FALSE
 $mbflags = NULL
 $mbconnstr = NULL
 $mbox = NULL
 $mbres = NULL

Private Member Functions

 parts ($structure, $msgno, $partno=FALSE)
 part_decode ($encoding, $text)
 mime_type ($structure)
 error ()
 check_mbox ($mbox_name, $open_mode=OP_READONLY)

Private Attributes

 $mode = NULL
 $check = NULL

Detailed Description

Class IMAP

Definition at line 11 of file imap.lib.


Constructor & Destructor Documentation

__construct ( user,
pass,
host = NULL,
port = NULL,
service = NULL,
mb_delim = NULL,
encrypt_mode = NULL,
validate_cert = NULL,
readonly = NULL 
)

The object constructor.

Parameters:
$user
  • The user name for the service.
$pass
  • The password for the service user.
$host
  • The host for the service.
$port
  • The port for the service.
$service
  • The type of the service (imap, pop3 or nntp).
$mb_delim
  • The delimiter for the mailbox folders (e.g. .).
$encrypt_mode
  • The encryption mode of the service (tls, ssl or notls).
$validate_cert
  • Do we validate server certificates (yes or no).
$readonly
  • Open the service in read only mode operation (yes or no).
  • Used primarily for debugging purposes to ensure the mailbox contents are not changed.

Definition at line 59 of file imap.lib.

References $host, $port, and $service.

                                                                                                                                                                    {
    $this->mbuser = array('user' => $user, 'pass' => $pass);
    if ($host) $this->host = $host;
    if ($port) $this->port = $port;
    if ($service) $this->service = $service;
    $this->encrypt = $encrypt_mode;
    $this->encrypt = ($this->encrypt === 'none' || is_null($this->encrypt)) ? FALSE : $this->encrypt;
    if ($validate_cert) $this->validate = ($validate_cert) === 'yes' ? TRUE : FALSE;
    if ($mb_delim) $this->mbdelim = $mb_delim;
    if ($readonly) $this->mbreadonly = ($readonly) === 'yes' ? TRUE : FALSE;
    $this->mbflags = '/service=' . $this->service;
    if ($this->mbreadonly) {
      $this->mbflags .= '/readonly';
    }
    if ($this->encrypt) {
      $this->mbflags .= '/' . $this->encrypt;
    }
    if ($this->validate) {
      $this->mbflags .= '/validate-cert';
    }
    else {
      $this->mbflags .= '/novalidate-cert';
    }
  }
__destruct ( )

The object destructor.

Definition at line 87 of file imap.lib.

References close().

                        {
    $this->close();
  }

Member Function Documentation

__set ( param,
value 
)

Set a parameter like magic.

Parameters:
$param
  • The parameter to set.
$value
  • The value to store in the parameter.

Definition at line 100 of file imap.lib.

                                  {
     switch ($param) {
       case 'mbox':
       case 'mailbox': {
         $this->mbox = $value;
       } break;
     }
   }
bodystruct ( msgno,
partno 
)

Get the structure of a specified message and body part.

Parameters:
$msgno
  • The message sequence number.
$partno
  • The body section string.
Returns:
See also:
fetchstructure.

Definition at line 587 of file imap.lib.

References error(), and open().

                                       {
    static $except = FALSE;
    $fetch = imap_bodystruct($this->mbres, $msgno, $partno);
    $error = $this->error();
    if ($error) {
      switch ($error->type) {
        case 'CLOSED': {
          if (!$except) {
            $this->open(0, TRUE);
            $except = TRUE;
            return $this->bodystruct($msgno, $partno);
          }
          else {
            throw new Exception($error->text);
          }
        } break;
        case 'WARNING': {
          //ignore.
        } break;
        default: {
          throw new Exception($error->text);
        } break;
      }
    }
    $except = FALSE;
    return $fetch;
  }
check ( mbox_name = NULL)

Check the mailbox.

Parameters:
$mbox_name
  • An optional mailbox name to check.
Returns:
  • An object whose parameters give the following or FALSE on error. -- Date - The system date. -- Driver - The access driver. -- Mailbox - The mailbox name. -- Nmsgs - The number of messages in the mailbox. -- Recent - The number of recent messages in the mailbox.

Definition at line 195 of file imap.lib.

References check_mbox().

                                    {
    $this->check_mbox($mbox_name);
    return imap_check($this->mbres);
  }
check_mbox ( mbox_name,
open_mode = OP_READONLY 
) [private]

Check if the named bmailbox is open.

Parameters:
$mbox_name
  • The mailbox name.
$open_mode
  • An optional mode to open the channel in.
Todo:
open_mode should reflect the previous value.

Definition at line 903 of file imap.lib.

Referenced by check(), expunge(), fetch_overview(), list_headers(), and status().

                                                                    {
    if ($mbox_name) {
      if ($mbox_name != $this->mbox) {
        $this->mbox = $mbox_name;
        $this->open($open_mode);
      }
    }
  }
close ( )

Close the service connection.

Returns:
  • The value of the close result or NULL.

Definition at line 175 of file imap.lib.

Referenced by __destruct().

                   {
    $return = NULL;
    if (is_resource($this->mbres)) $return = imap_close($this->mbres);
    return $return;
  }
copy_item ( msgno,
to_folder 
)

Copy an item from the current folder to a specified folder.

Parameters:
$msgno
$to_folder
  • The folder to move the item to.
Returns:
  • The result of the move, TRUE or FALSE.

Definition at line 326 of file imap.lib.

                                         {
    return imap_mail_copy($this->mbres, $msgno, $to_folder);
  }
delete_item ( msgno)

Definition at line 311 of file imap.lib.

                               {
    return imap_delete($this->mbres, $msgno);
  }
error ( ) [private]

Get the last error.

Returns:
  • An object with the following parameters. -- type - The type of the error. --- WARNING - Based on the error text this is a warning. --- CLOSED - Based on the error text the channel is closed. --- UNKNOWN - Unable to determine the type based on the error text. -- text - The text of the error.

Definition at line 831 of file imap.lib.

Referenced by bodystruct(), fetchheader(), fetchstructure(), headerinfo(), and open().

                           {
    $text = imap_last_error();
    if ($text === FALSE) {
      return $text;
    }
    $parts = explode(' ', strtolower($text));
    switch ($parts[0]) {
      case 'warning:': {
        $type = 'WARNING';
      } break;
      case 'unexpected': {
        $type = 'WARNING';
      } break;
      case 'unterminated': {
        $type = 'WARNING';
      } break;
      case '[closed]': {
        $type = 'CLOSED';
      } break;
      case 'invalid': {
        if ($parts[1] === 'mailbox' && $parts[2] === 'list:' && $parts[3] === '<>') {
          $type = 'WARNING';
        }
        else {
          $type = 'UNKNOWN';
        }
      } break;
      case 'must': {
        if ($parts[1] === 'use' && $parts[2] === 'comma') {
          $type = 'WARNING';
        }
        else {
          $type = 'UNKNOWN';
        }
      } break;
      case 'no': {
        if ($parts[1] === 'body' && $parts[2] === 'information') {
          $type = 'WARNING';
        }
        else {
          $type = 'UNKNOWN';
        }
      } break;
      case 'store': {
        if ($parts[3] === 'read-only') {
          $type = 'WARNING';
        }
        else {
          $type = 'UNKNOWN';
        }
      } break;
      default: {
        $type = 'UNKNOWN';
      } break;
    }
    $error->type = $type;
    $error->text = $text;
    return $error;
  }
expunge ( mbox_name = NULL)

Removed the items marked deleted.

Parameters:
$mbox_name
  • An optional mailbox name to expunge.
Returns:
  • The result of imap_expunge.

Definition at line 354 of file imap.lib.

References check_mbox().

                                      {
    $this->check_mbox($mbox_name);
    return imap_expunge($this->mbres);
  }
fetch_item ( msgno,
mime_part = 'TEXT/PLAIN',
parts = NULL 
)

Get the specified mime_part of the item body for the specified message.

Parameters:
$msgno
  • The message sequence number.
$mime_part
  • An optional string defining which MIME body parts to return.
$parts
  • An optional array used to aid the recursive call.
Returns:
  • The specified mime body parts. -- If the $mime_part is TEXT/* and more than one part contains the specified $mime_part they are concantenated together and separated with "\r\n\r\n". -- If the $mime_part is not TEXT/* the value returned is an array of objects containing the parts attributes and values.

Definition at line 677 of file imap.lib.

References parts().

                                                                        {
    if (is_null($parts)) {
      $structure = imap_fetchstructure($this->mbres, $msgno);
      $parts = $this->parts($structure, $msgno);
      return $this->fetch_item($msgno, $mime_part, $parts);
    }
    else {
      $ret = NULL;
      foreach ($parts as $part) {
        if ($part->mime_type === $mime_part) {
          $ret .= "\r\n\r\n" . $part->text;
        }
        elseif ($mime_part == 'ATTACHMENT' &&
          $part->disposition == 'attachment')
        {
          $att = new stdClass;
          $att->subtype = $att->filename = $att->name = NULL;
          $att->subtype = $part->subtype;
          if ($part->dparameters) {
            $att->{$part->dparameters[0]->attribute} = $part->dparameters[0]->value;
          }
          if ($part->parameters) {
            $att->{$part->parameters[0]->attribute} = $part->parameters[0]->value;
          }
          $att->contents = $part->text;
          $ret[] = $att;
        }
      }
      return $ret;
    }
  }
fetch_overview ( messages,
mbox_name = NULL 
)

Get an overview of the messages in a mailbox.

Parameters:
$messages
  • A string defining the message sequences to retrieve. -- Use a form of X,Y for a list. -- Use a form of X:Y for a range. -- A list and a range can be used together as in X:Y,Z -- Do not include spaces.
$mbox_name
  • An optional specified mailbox name.
Returns:
  • An array of objects describing one message header. -- The possible object parameters are: --- subject - the message subject --- from - who sent it --- to - the message recipient --- date - the message sent date --- message_id - A unique message identifier --- in_reply_to - The message_id that is being replied to --- size - The message size in bytes --- uid - The UID assigned the message in the mailbox --- msgno - The message sequence number --- recent - The message recent flag --- flagged - The message flagged flag --- answered - The message answered flag --- deleted - The message deleted flag --- seen - The message seen flag --- draft - The message draft flag

Definition at line 263 of file imap.lib.

References check_mbox().

                                                        {
    $this->check_mbox($mbox_name);
    watchdog('imap debug', print_r($messages, true));
    return imap_fetch_overview($this->mbres, $messages, 0);
  }
fetchheader ( msgno)

Get the complete unfiltered header of a specified message.

Parameters:
$msgno
  • The message sequence number.
Returns:
  • A string containing the full message header.

Definition at line 486 of file imap.lib.

References error(), and open().

                               {
    static $except = FALSE;
    $fetch = imap_fetchheader($this->mbres, $msgno);
    $error = $this->error();
    if ($error) {
      switch ($error->type) {
        case 'CLOSED': {
          if (!$except) {
            $this->open(0, TRUE);
            $except = TRUE;
            return $this->fetchheader($msgno);
          }
          else {
            throw new Exception($error->text);
          }
        } break;
        case 'WARNING': {
          //ignore.
        } break;
        default: {
          throw new Exception($error->text);
        } break;
      }
    }
    $except = FALSE;
    return $fetch;
  }
fetchstructure ( msgno)

Get the structure of a specified message.

Parameters:
$msgno
  • The message sequence number.
Returns:
  • An object that includes the envelope, internal date, size, flags and body structure along with a similar object for each mime attachment. -- The possible object parameters are: --- type - Primary body type --- encoding - Body transfer encoding --- ifsubtype - TRUE if there is a subtype string --- subtype - MIME subtype string --- ifdescription - TRUE if there is a description string --- description - Content description string --- ifid - TRUE if there is an identification string --- id - Identification string --- lines - Number of lines --- bytes - Number of bytes --- ifdisposition - TRUE if there is a disposition string --- disposition - Disposition string --- ifdparameters - TRUE if the dparameters array exists --- dparameters - An array of objects Each object has an "attribute" and "value" property corresponding to the Content-disposition MIME header --- ifparameters - TRUE if the parameters array exists --- parameters - An array of objects Each object has an "attribute" and "value" property --- parts - An array of objects Each object corresponds to a MIME body part and has a parameter structure similar to its parent

Definition at line 547 of file imap.lib.

References error(), and open().

                                  {
    static $except = FALSE;
    $fetch = imap_fetchstructure($this->mbres, $msgno);
    $error = $this->error();
    if ($error) {
      switch ($error->type) {
        case 'CLOSED': {
          if (!$except) {
            $this->open(0, TRUE);
            $except = TRUE;
            return $this->fetchstructure($msgno);
          }
          else {
            throw new Exception($error->text);
          }
        } break;
        case 'WARNING': {
          //ignore.
        } break;
        default: {
          throw new Exception($error->text);
        } break;
      }
    }
    $except = FALSE;
    return $fetch;
  }
headerinfo ( msgno)

Get the header of the message.

Parameters:
$msgno
  • The message sequence number.
Returns:
  • An object message header details. -- The possible object parameters are: --- toaddress - full to: line up to 1024 characters --- to - an array of objects from the To: line with the following parameters ---- - personal - Name or description of mailbox user ---- - adl ---- - mailbox - The mailbox user, left of @ ---- - host - The hostname for user mailbox --- fromaddress - full from: line up to 1024 characters --- from - an array of objects from the From: line with the following parameters ---- - personal - Name or description of mailbox user ---- - adl ---- - mailbox - The mailbox user, left of @ ---- - host - The hostname for user mailbox --- ccaddress - full cc: line up to 1024 characters --- cc - an array of objects from the Cc: line with the following parameters ---- - personal - Name or description of mailbox user ---- - adl ---- - mailbox - The mailbox user, left of @ ---- - host - The hostname for user mailbox --- bccaddress - full bcc: line up to 1024 characters --- bcc - an array of objects from the Bcc: line with the following parameters ---- - personal - Name or description of mailbox user ---- - adl ---- - mailbox - The mailbox user, left of @ ---- - host - The hostname for user mailbox --- reply_toaddress - full reply-to: line up to 1024 charcters --- reply_to - an array of objects from the Reply-To: line with the following parameters ---- - personal - Name or description of mailbox user ---- - adl ---- - mailbox - The mailbox user, left of @ ---- - host - The hostname for user mailbox --- senderaddress - full sender: line up to 1024 characters --- sender - an array of objects from the Sender: line with the following parameters ---- - personal - Name or description of mailbox user ---- - adl ---- - mailbox - The mailbox user, left of @ ---- - host - The hostname for user mailbox --- return_pathaddress - full return-path: line up to 1024 characters --- return_path - an array of objects from the Return-Path: line with the following parameters --- remail --- date - The date the messages was sent --- Date - Same as date --- subject - The message subject --- Subject - Same as subject --- in_reply_to --- message_id --- newsgroups --- followup_to --- references --- Recent - The message recent flag ---- R if recent and seen ---- N if recent and not seen ---- '' if not recent --- Unseen - The message unseen flag ---- U if not seen and Recent is '' ---- '' if seen or Recent is N --- Flagged - The message flagged flag ---- F if flagged ---- '' if not flagged --- Answered - The message answered flag ---- A if answered ---- '' if unanswered --- Deleted - The message deleted flag ---- D if deleted ---- '' if not deleted --- Draft - The message draft flag ---- X if draft ---- '' if not draft --- Msgno - The message sequence number --- MailDate --- Size - The message size in bytes --- udate - The message date in Unix time --- fetchfrom - From line formatted to fromlength characters --- fetchsubject - Subject line formatted to subjectlength chars

Definition at line 449 of file imap.lib.

References error(), and open().

                              {
    static $except = FALSE;
    $fetch = imap_headerinfo($this->mbres, $msgno);
    $error = $this->error();
    if ($error) {
      switch ($error->type) {
        case 'CLOSED': {
          if (!$except) {
            $this->open(0, TRUE);
            $except = TRUE;
            return $this->headerinfo($msgno);
          }
          else {
            throw new Exception($error->text);
          }
        } break;
        case 'WARNING': {
          //ignore.
        } break;
        default: {
          throw new Exception($error->text);
        } break;
      }
    }
    $except = FALSE;
    return $fetch;
  }
list_headers ( mbox_name)

Get a list of all headers.

Parameters:
$mbox_name
  • The mailbox name.
Returns:
  • An array of objects describing one message header. -- The possible object parameters are: --- subject - the message subject --- from - who sent it --- to - the message recipient --- date - the message sent date --- message_id - A unique message identifier --- in_reply_to - The message_id that is being replied to --- size - The message size in bytes --- uid - The UID assigned the message in the mailbox --- msgno - The message sequence number --- recent - The message recent flag --- flagged - The message flagged flag --- answered - The message answered flag --- deleted - The message deleted flag --- seen - The message seen flag --- draft - The message draft flag

Definition at line 294 of file imap.lib.

References $check, and check_mbox().

                                    {
    $headers = array();
    $this->check_mbox($mbox_name);
    $check = imap_check($this->mbres);
    $headers = imap_fetch_overview($this->mbres, "1:{$check->Nmsgs}", 0);
    return $headers;
  }
list_mbox ( mbox)

Get the mailbox information for the specified information with the status data infused.

Parameters:
$mbox
  • The specified mailbox name.
Returns:
  • An object of the mailbox information.

Definition at line 625 of file imap.lib.

References $mbox.

Referenced by list_mboxes().

                            {
    $mboxes = imap_getmailboxes($this->mbres, $this->mbconnstr, $mbox);
    if (count($mboxes) === 0) {
      return FALSE;
    }
    elseif (count($mboxes) > 1) {
      throw new Exception('Invalid mailbox specification.');
    }
    $mbx =& $mboxes[0];
    $status = imap_status($this->mbres, $this->mbconnstr . $mbox, SA_ALL);
    foreach ((array)$status as $key => $stat) {
      $mbx->$key = $stat;
    }
    return $mbx;
  }
list_mboxes ( )

Get a list of all mailboxes for the open connection.

Returns:
  • An array of objects.
See also:
list_mbox.

Definition at line 647 of file imap.lib.

References $mbox, and list_mbox().

                         {
    $mboxes = imap_getmailboxes($this->mbres, $this->mbconnstr, '*');
    $return = array();
    foreach ($mboxes as $mbox) {
      list(,$mbox) = explode('}', $mbox->name);
      $return[] = $this->list_mbox($mbox);
    }
    return $return;
  }
mime_type ( structure) [private]

Determine the MIME type from the structure.

Parameters:
$structure
  • The mail item structure object.
Returns:
  • A string of describing the MIME type, e.g. "TEXT/PLAIN".

Definition at line 808 of file imap.lib.

                                         {
    $primary_mime_types = array('TEXT', 'MULTIPART', 'MESSAGE', 'APPLICATION', 'AUDIO', 'IMAGE', 'VIDEO', 'OTHER');
    if ($structure->subtype) {
      $mime_type = $primary_mime_types[$structure->type] . '/' . $structure->subtype;
    }
    else {
      $mime_type = "TEXT/PLAIN";
    }
    return $mime_type;
  }
move_item ( msgno,
to_folder 
)

Move an item from the current folder to a specified folder.

Parameters:
$msgno
$to_folder
  • The folder to move the item to.
Returns:
  • The result of the move, TRUE or FALSE.

Definition at line 341 of file imap.lib.

                                         {
    return imap_mail_move($this->mbres, $msgno, $to_folder);
  }
open ( mode = 0,
force = FALSE 
)

Open the service.

Parameters:
$mode
  • One or a ORed combination of -- OP_READONLY -- OP_ANONYMOUS -- OP_HALFOPEN -- OP_DEBUG -- OP_SHORTCACHE -- OP_SILENT -- OP_PROTOTYPE -- OP_SECURE -- CL_EXPUNGE
$force
  • Force a new connection instead of reusing a connection.
Returns:
  • The connection resource value.

Definition at line 130 of file imap.lib.

References $mode, and error().

Referenced by bodystruct(), fetchheader(), fetchstructure(), and headerinfo().

                                           {
    if (!$this->mbconnstr) {
      $this->mbconnstr = '{' . $this->host . ':' . $this->port . $this->mbflags . '}';
    }
    $user =& $this->mbuser['user'];
    $pass =& $this->mbuser['pass'];
    if ($this->mbreadonly) {
      $mode |= OP_READONLY;
    }
    if ($mode & OP_HALFOPEN) {
      $mb = NULL;
    }
    else {
      $mb = $this->mbox;
    }
    if (!$force && $this->mbres) {
      imap_reopen($this->mbres, $this->mbconnstr . $mb, $mode);
      $error = $this->error();
      if ($error->type == 'CLOSED') {
        return  $this->open($mode, TRUE);
      }
    }
    else {
      if ($force && !$mode) {
        $mode == $this->mode;
      }
      else {
        $this->mode = $mode;
      }
      $this->mbres = imap_open($this->mbconnstr . $mb, $user, $pass, $mode);
    }
    if ($errors = imap_errors()) {
      foreach ($errors as $error) {
        drupal_set_message($error, 'error');
      }
    }
    return  $this->mbres;
  }
part_decode ( encoding,
text 
) [private]

Decode the encoded text.

Parameters:
$encoding
  • The encoding value of the structure.
$text
  • The text to be decoded.
Returns:
  • The decoded text.

Definition at line 783 of file imap.lib.

                                                 {
    switch ($encoding) {
      case 3: {
        return imap_base64($text);
      } break;
      case 4: {
        return quoted_printable_decode($text); // This resolved and issue of NULL being returned with imap_qprint
        return imap_qprint($text);
      } break;
      default: {
        return $text;
      } break;
    }
  }
parts ( structure,
msgno,
partno = FALSE 
) [private]

Get the parts of the email body.

Parameters:
$structure
  • The mail item structure object.
$msgno
  • The message sequence number.
$partno
  • Used for recursive calls to control which part.
Returns:

Definition at line 724 of file imap.lib.

Referenced by fetch_item().

                                                              {
    if ($structure) {
      $parts = array();
      if (!$structure->parts) {
        if ($partno === FALSE) {
          $partno = '1';
        }
        $body = imap_fetchbody($this->mbres, $msgno, $partno);
        $bodystruct = imap_bodystruct($this->mbres, $msgno, $partno);
        $body = $this->part_decode($bodystruct->encoding, $body);
        if ($bodystruct->ifparameters) {
          foreach ($bodystruct->parameters as $parameter) {
            if (strtolower($parameter->attribute) == 'charset') {
              $body = iconv($parameter->value, 'utf-8', $body);
              break;
            }
          }
        }
        $part = new stdClass;
        $part->partno = $partno;
        $part->mime_type = $this->mime_type($bodystruct);
        $part->text = $body;
        $part->bytes = $bodystruct->bytes;
        $part->subtype = $bodystruct->ifsubtype ? $bodystruct->subtype : NULL;
        $part->disposition = $bodystruct->ifdisposition ? $bodystruct->disposition : NULL;
        $part->dparameters = $bodystruct->ifdparameters ? $bodystruct->dparameters : NULL;
        $part->parameters = $bodystruct->ifparameters ? $bodystruct->parameters : NULL;
        $parts[$partno] = $part;
      }
      else {
        while (list($index, $substructure) = each($structure->parts)) {
          if ($partno) {
            $prefix = $partno . '.';
          }
          else {
            $prefix = NULL;
          }
          $data = $this->parts($substructure, $msgno, $prefix . ($index + 1));
          $parts += $data;
        }
      }
      return $parts;
    }
    return FALSE;
  }
status ( mbox_name = NULL,
options = SA_ALL 
)

Get status information for the mailbox.

Parameters:
$mbox_name
  • An optional mailbox name.
$options
  • One or more of the following ORed bit mask options. -- SA_MESSAGES - Give the number of messages in the mailbox. -- SA_RECENT - Give the number of recent messages in the mailbox. -- SA_UNSEEN - Give the number of unseen messages in the mailbox. -- SA_UIDNEXT - Give the next uid to be used in the mailbox. -- SA_UIDVALIDITY - Give a constant that changes when the uids for the mailbox may no longer be valid. -- SA_ALL - All of the above.
Returns:
  • An object whose parameters give the following or FALSE on error. -- messages - The number of messages in the mailbox. -- recent - The number of recent messages in the mailbox. -- unseen - The number of unseen messages in the mailbox. -- uidnext - The next uid to be used in the mailbox. -- uidvalidity - A constant that changes when uids for the mailbox may no longer be valid.

Definition at line 225 of file imap.lib.

References $mbox, and check_mbox().

                                                        {
    $this->check_mbox($mbox_name);
    $mbox = $this->mbconnstr . $this->mbox;
    return imap_status($this->mbres, $mbox, $options);
  }

Field Documentation

$check = NULL [private]

Definition at line 25 of file imap.lib.

Referenced by list_headers().

$encrypt = 'none' [protected]

Definition at line 15 of file imap.lib.

$host = 'localhost' [protected]

Definition at line 12 of file imap.lib.

Referenced by __construct().

$mbconnstr = NULL [protected]

Definition at line 21 of file imap.lib.

$mbdelim = '.' [protected]

Definition at line 17 of file imap.lib.

$mbflags = NULL [protected]

Definition at line 20 of file imap.lib.

$mbox = NULL [protected]

Definition at line 22 of file imap.lib.

Referenced by list_mbox(), list_mboxes(), and status().

$mbreadonly = FALSE [protected]

Definition at line 19 of file imap.lib.

$mbres = NULL [protected]

Definition at line 23 of file imap.lib.

$mbuser = array('user' => 'mbuser', 'pass' => 'mbpass') [protected]

Definition at line 18 of file imap.lib.

$mode = NULL [private]

Definition at line 24 of file imap.lib.

Referenced by open().

$port = 143 [protected]

Definition at line 13 of file imap.lib.

Referenced by __construct().

$service = 'imap' [protected]

Definition at line 14 of file imap.lib.

Referenced by __construct().

$validate = FALSE [protected]

Definition at line 16 of file imap.lib.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations