Smiling Souls

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


0.3.0 Beta

Bug Fixes
  • Added PHP5 public/protected/private
  • Removed Net_URL dependency, replaced with parse_url
  • Removed PEAR error stack, replaced with trigger_error
  • Removed .tgz package, replaced with .zip package
  • Fixed MIME header decoding.

0.2.0 Beta

Bug fixes
  • Major bug in broken nested message parsing (affected multipart/mixed messages), sub messages weren't being retrieved.
  • Broken retrieval of sub-message headers
  • #4264 foreach() called without argument check

0.1.0 Beta

Bug fixes
  • Bug parsing certain multipart/signed messages fixed.
  • #2867 E_WARNING Couldn't open stream
API Changes
  • Package renamed Mail_IMAPv2, to comply with PEAR naming conventions.
  • Private method _isMultipartRelated renamed _isMultipart, $subtype argument added.

Note: Releases prior to 0.1.0 refer to the non-PEAR-released alpha candidate releases, which follow a different naming and version numbering convention. Version numbering was changed to 0.1.0 for this release to comply with PEAR version numbering conventions.


Bug fixes
  • #2550 variable has wrong name.
  • getRelatedParts doesn't work if the part number is in the top level of nesting.


Bug fixes
  • #2289 Mail_IMAP uses static notation where instance notation should be used.
  • Bug in extractMIME method, $rtn variable was being overwritten, thus preventing MIME extraction.


Lots of API changes in Mail_IMAP 2.0.0 the following outlines each of the changes made to the API in detail and compares those changes with the 1.1.0 release to aid in the transition from Mail_IMAP 1.1.0 to 2.0.0.

General Changes / Bug fixes
  • License changed from PHP to BSD.
  • multipart/related parts not detected, argument passed from Mail_IMAP::_isMultipartRelated to Mail_IMAP::extractMIME not an array.
  • Fixed bug with header association, headers were not retrieved if the supplied part id referred to an attachment or multipart/related part.
  • Debugged Mail_IMAP_Debug class.
  • #2286: Use of return in constructor.
Property Changes

The first set of changes are to the member variables.. there are far too many, so these have been consolidated into arrays. This consolidation resulted in about 10KB being shaved from the file size of IMAP.php and IMO, results in a better API.

Mail_IMAP 1.1.0 Mail_IMAP 2.0.0
$this->_structure $this->structure[$mid]['obj']
$this->_pid $this->structure[$mid]['pid']
$this->_ftype $this->structure[$mid]['ftype']
$this->_fname $this->structure[$mid]['fname']
$this->_disposition $this->structure[$mid]['disposition']
$this->_encoding $this->structure[$mid]['encoding']
$this->_inlineId $this->structure[$mid]['cid']
$this->_hasAttachments $this->structure[$mid]['has_at']
Note: Additional parameters are now also available in the $structure property. If the parameter exists, a lowercase indice of the same name is created. For instace, the 'charset' param of a message part is available as $this->structure[$mid]['charset']
$this->defaultPid $this->msg[$mid]['pid']
Note: The default PID should now always be accessed via its property, as the getDefaultPID method was made private in 2.0.0. This prevents redundancy, since the default PID is used in several places.
$this->inPid $this->msg[$mid]['in']['pid']
$this->inFtype $this->msg[$mid]['in']['ftype']
$this->inFsize $this->msg[$mid]['in']['fsize']
$this->inFname $this->msg[$mid]['in']['fname']
$this->inHasAttach $this->msg[$mid]['in']['has_at']
$this->inInlineId $this->msg[$mid]['in']['cid']
$this->attachPid $this->msg[$mid]['at']['pid']
$this->attachFtype $this->msg[$mid]['at']['ftype']
$this->attachFsize $this->msg[$mid]['at']['fsize']
$this->attachFname $this->msg[$mid]['at']['fname']
$this->attachHasAttach $this->msg[$mid]['at']['has_at']
$rawHeaders $this->header[$mid]['raw']

Mail_IMAP::$fields was added. It defines the fields available to the 'in' and 'at' arrays of the Mail_IMAP::$msg property. By default these are: 'fname', 'pid', 'ftype', 'fsize', 'has_at', 'charset' and 'cid'.

Note: Fields are only set in the 'in' and 'at' arrays if the field exists for that message part. Prior to Mail_IMAP 2, if the field didn't exist it was created with NULL value in these arrays.

Method Changes

Thanks to Magnus Johansson for providing internationalization bug fixes.

  • 1.1.0: Mail_IMAP($connection = NULL, $options = NULL, $error_reporting = E_ALL)
  • 2.0.0: Mail_IMAP($connection = NULL, $get_info = TRUE)

Removed the deprecated $options argument. $error_reporting functionality replaced by PEAR_ErrorStack.

$get_info (BOOL) decides whether the Mail_IMAP::connect method should automatically call on Mail_IMAP::getMailboxInfo.


New in Mail_IMAP 2.0.0. This template is used by PEAR_ErrorStack.

  • 1.1.0: connect($connect, $options = NULL)
  • 2.0.0: connect($uri, $get_info = TRUE)

Deprecated $options argument removed. Mail_IMAP::debug is no longer called on automatically from this method, Mail_IMAP::debug was moved to its own class, which extends Mail_IMAP as Mail_IMAP_Debug.

The $connect argument was renamed $uri, since only a URI can be passed. Despite the name change, this is still the same argument.

  • 1.1.0: setOptions($option_set, $constant)
  • 2.0.0: setOptions($options, $constant)

$option_set argument argument renamed $options.


Method returns BOOL, Pear_Error removed completely.


Underscore prexied applied to indicate this method is now private, the $this->msg[$mid]['pid'] property should be used instead of calling on Mail_IMAP::_getDefaultPid directly for the default part id.


Extra message parameters (charset, etc) now added to $structure member variable. Please notify me right away if this causes things to go awry.

  • 1.1.0: getParts(&$mid, &$pid, $MIME = 'text/html', $getAlternative = TRUE, $retrieve_all = FALSE)
  • 2.0.0: getParts(&$mid, &$pid, $rtn = FALSE, $args = array())
Argument changes:
Mail_IMAP 1.1.0 Mail_IMAP 2.0.0
$MIME $args['get_mime']
$getAlternative $args['get_alternative']
$retrieve_all $args['retrieve_all']

$rtn argument added as a toogle to return the contents of the Mail_IMAP::$msg property.


New in Mail_IMAP 2.0.0. Searches for related parts, if related parts exist, returns an array containing cids, pids and ftypes. I expect this method will work in the majority of scenarios, however, it has not been extensively tested. Please report any bugs.


New in Mail_IMAP 2.0.0. Formerly Mail_IMAP::_addInlinePart and Mail_IMAP::_addAttachment, new method created, merged the _addInlinePart and _addAttachment methods into one method. Also created Mail_IMAP::$fields property for this method. The fields added to the Inline and Attachment arrays can be specified explicitly through the new Mail_IMAP::$fields property.

  • 1.1.0: getRawMessage(&$mid, $options = NULL)
  • 2.0.0: getRawMessage(&$mid)

Deprecated $options argument removed.

  • 1.1.0: getBody(&$mid, $pid = '1', $action = 0, $getPart = 'text/html', $options = NULL, $attempt = 1)
  • 2.0.0: getBody(&$mid, $pid = '1', $action = 0, $get_mime = 'text/html', $attempt = 1)

Character set now returned as part of the returned array.

utf8_decode && imap_utf8 decoding automatically preformed on the message is utf-8 encoding is specified via the Mail_IMAP::_decodeMessage method.

Deprecated $options argument removed.

The $getPart argument was renamed $get_mime, the name change was made for consistency, this argument provides the same functionality.


$MIME argument now only accepts an array.

  • 1.1.0: getRawHeaders(&$mid, $pid = '0', $options = NULL, $rtn = TRUE)
  • 2.0.0: getRawHeaders(&$mid, $pid = '0', $rtn = TRUE)

Deprecated $options argument removed.

  • 1.1.0: getHeaders(&$mid, $pid = '0', $from_length = 1024, $subject_length = 1024, $default_host = NULL, $options = NULL)
  • 2.0.0: getHeaders(&$mid, $pid = '0', $rtn = FALSE, $args = array())

Deprecated $options argument removed.

Argument changes:
Mail_IMAP 1.1.0 Mail_IMAP 2.0.0
$from_length $args['from_length']
$subject_length $args['subject_length']
$default_host $args['default_host']

$rtn toggle added to return the contents of the $header property.

utf8_decode && imap_utf8 functions applied to headers. Additional headers created in the $header member variable.

  • 1.1.0: getQuota($folder = NULL)
  • 2.0.0: getQuota($folder = NULL, $rtn = TRUE)

$rtn argument added to toggle whether the method returns the quota or merges the retrieved information into the Mail_IMAP::$mailboxInfo property.

  • 1.1.0: setFlags($mids, $flags, $action = 3, $options = NULL)
  • 2.0.0: setFlags($mids, $flags, $action = 3)

Deprecated $options argument removed.

Other Changes

All methods that used to return PEAR_Error now return BOOL instead. All errors are logged using PEAR_ErrorStack. The ErrorStack object is available in the Mail_IMAP::$error property.

Other changes include the addition of modularized mailbox management features. A new class has been added to integrate these features as an extension to Mail_IMAP.. These new features are available in the Mail_IMAP_ManageMB class, which inherits from Mail_IMAP.

New classes that inherit from Mail_IMAP

Mailbox management funcationality was placed in its own class since it isn't likely that everyone will need mailbox management functionality, and is also unlikely that users will need mailbox management functionality everytime they use their mailbox.


Simply calls on Mail_IMAP::Mail_IMAP with the same argument list.


Create/Delete/Rename a mailbox on the server.


Copy or permenently move mail from one mailbox to another.


Import mail into the server.

Note: I have done my best to document the changes thouroughly, but as with anything, its possible that I missed something.


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.