//Build message list foreach ($emails as $email) { // Disable the message popup for external accounts if ($atmail->LoginType == 'simple' || $atmail->LoginType == 'xul' || $atmail->Ajax) { $atmail->Advanced = ''; } $i++; // Load a hash containing the message headers //$db = $mail->gethead( $db['id'], $var['folder'], 9, $atmail->Advanced ); // If we are reading from the local Maildir folders or SQL tables if ($mail->Mode == 'file' || $mail->Type == 'sql') { $id = $email['id']; } elseif (isset($email['UID'])) { $id = $email['UID']; } $email = array_merge($email, $mail->message_headers($email['header'], $id)); $email = $mail->cleanbody($email); // Create cache id for email. Added check for existing cache ID to help avoid any // clash where two emails have the same EmailUIDL e.g same address appears multiple // times in To, CC, or BCC headers // If cache id already exists we append '_$i' where $i is incremented until the cache // id is unique $email['EmailCache'] = $email['EmailUIDL']; if (in_array($email['EmailCache'], $cacheIDs)) { $j = 2; while (in_array("{$email['EmailCache']}_{$j}", $cacheIDs)) { $j++; } $email['EmailCache'] .= "_{$j}"; } $cacheIDs[] = $email['EmailCache'];