It creates a new recursive iterator based on the contents of the message with id $i and loops through the parts of the e-mail. E-mails generally consist of multi-part messages, so the getmessage method probably has a call to retrieve the first part of the message after retrieving headers. The method to get the part likely calls itself (recursively) with an incrementing id to return the part, hence the $ii=>$part.
It is difficult to expand without knowing the full contents of the method call.
Example for Directory recursion
$dir = new RecursiveDirectoryIterator(".");
foreach(new RecursiveIteratorIterator($dir) as $file) {
// find .txt files
if (preg_match('/.txt$/i', $file->getFilename())) {
}
}
EDIT 2: Using the example on the linked site:
$foundPart = null;
foreach (new RecursiveIteratorIterator($mail->getMessage(1)) as $part) {
if (strtok($part->contentType, ';') == 'text/plain') {
$foundPart = $part;
break;
}
}
This retrieves all the parts and looks for a plaintext part. It is a way of looping through something recursively allowing manipulation on it.