method getEmailsList documentation in bbn\Appui\Mailbox

function(string $folder, int $start, int $end) { if (isset($this->folders[$folder]) && ($end > $start) && $this->selectFolder($folder) ) { $res = []; while ($start <= $end) { $tmp = (array)$this->getMsgHeaderinfo($start); $structure = $this->getMsgStructure($start); if (!$tmp || !$structure) { throw new \Exception("Wrong number? $start"); } $tmp['date_sent'] = date('Y-m-d H:i:s', strtotime($tmp['Date'])); $tmp['date_server'] = date('Y-m-d H:i:s', strtotime($tmp['MailDate'])); $tmp['uid'] = $this->getMsgUid($start); unset( $tmp['Date'], $tmp['MailDate'], $tmp['Subject'], $tmp['sender'], $tmp['toaddress'], $tmp['fromaddress'], $tmp['senderaddress'], $tmp['reply_toaddress'] ); foreach ($tmp as $k => $v) { if (is_string($v)) { $tmp[$k] = trim($v); if (empty($v)) { $tmp[$k] = false; } elseif (Str::isNumber($v)) { $tmp[$k] = (int)$v; } elseif ($k === 'subject') { $tmp[$k] = mb_convert_encoding(iconv_mime_decode($v, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, "UTF-8"), "UTF-8"); if (strlen($tmp[$k]) > 1000) { $tmp[$k] = Str::cut($tmp[$k], 1000); } } } } foreach (self::getDestFields() as $df) { if (!empty($tmp[$df])) { $ads = []; foreach ($tmp[$df] as $a) { if (isset($a->host)) { $ads[] = [ 'name' => empty($a->personal) ? null : mb_convert_encoding(iconv_mime_decode($a->personal, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, "UTF-8"), "UTF-8"), 'email' => strtolower($a->mailbox.'@'.$a->host), 'host' => $a->host ]; } else { $this->log((array)$a); } } $tmp[$df] = $ads; } } $tmp['references'] = empty($tmp['references']) ? [] : X::split(substr($tmp['references'], 1, -1), '> <'); $tmp['message_id'] = isset($tmp['message_id']) ? substr($tmp['message_id'], 1, -1) : ''; $tmp['in_reply_to'] = empty($tmp['in_reply_to']) ? false : substr($tmp['in_reply_to'], 1, -1); $tmp['attachments'] = []; $tmp['is_html'] = false; X::log(['real', $tmp], 'mail'); if (empty($structure->parts)) { $tmp['is_html'] = $structure->subtype === 'HTML'; } else { foreach ($structure->parts as $part) { if ($part->ifdisposition && (strtolower($part->disposition) === 'attachment') && $part->ifparameters) { $tmp['attachments'][] = [ 'name' => $part->parameters[0]->value, 'size' => $part->bytes, 'type' => Str::fileExt($part->parameters[0]->value) ]; } elseif (!empty($part->parts)) { foreach ($part->parts as $p) { if ($p->subtype === 'HTML') { $tmp['is_html'] = true; break; } } } elseif ($part->subtype === 'HTML') { $tmp['is_html'] = true; } } } $res[] = $tmp; $start++; } return $res; } }

BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.