当前位置: 首页>>代码示例>>PHP>>正文


PHP imap_getmailboxes函数代码示例

本文整理汇总了PHP中imap_getmailboxes函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_getmailboxes函数的具体用法?PHP imap_getmailboxes怎么用?PHP imap_getmailboxes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imap_getmailboxes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: free

 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'));
 }
开发者ID:gAb09,项目名称:NetP,代码行数:18,代码来源:ImapController.php

示例2: checkProcessedFolder

 private function checkProcessedFolder($mailbox)
 {
     $list = imap_getmailboxes($mailbox, '{' . $this->host . '}', $this->processedFolder);
     if (count($list) == 0) {
         throw new \Exception("You need to create imap folder '{$this->processedFolder}'");
     }
 }
开发者ID:martinstrycek,项目名称:imap-mail-downloader,代码行数:7,代码来源:Downloader.php

示例3: saveGmailDetails

 public function saveGmailDetails($parameters)
 {
     $username = $parameters["gmailusername"];
     $password = $parameters["gmailpassword"];
     $userid = $_SESSION["userid"];
     try {
         $inbox = $this->getImapConnection($username, $password, "INBOX");
     } catch (Exception $e) {
         error_log("Errror Caugt!!!");
         return self::$responder->constructErrorResponse("I could not connect to Gmail. Make sure your login details are correct.");
     }
     try {
         self::$gmailDAO->saveGmailDetails($userid, $username, $password);
     } catch (Exception $e) {
     }
     $folderList = array();
     $emailFolderList = imap_getmailboxes($inbox, self::INBOX, "*");
     error_log("list size: " . sizeof($emailFolderList));
     if (is_array($emailFolderList)) {
         $count = 0;
         foreach ($emailFolderList as $key => $val) {
             $temp = imap_utf7_decode($val->name);
             $folder = str_replace(self::INBOX, "", $temp);
             if (!strstr($folder, "[Gmail]")) {
                 $folderList["folder" . ++$count] = $folder;
             }
         }
     } else {
         return self::$responder->constructErrorResponse("Could not get the list of folder from your account, please try again.");
     }
     imap_close($inbox);
     return self::$responder->constructResponseForKeyValue(array_reverse($folderList));
 }
开发者ID:laiello,项目名称:time-travel,代码行数:33,代码来源:EmailServices.php

示例4: download_and_process_email_replies

 /**
  * Primary method for downloading and processing email replies
  */
 public function download_and_process_email_replies($connection_details)
 {
     imap_timeout(IMAP_OPENTIMEOUT, apply_filters('supportflow_imap_open_timeout', 5));
     $ssl = $connection_details['imap_ssl'] ? '/ssl' : '';
     $ssl = apply_filters('supportflow_imap_ssl', $ssl, $connection_details['imap_host']);
     $mailbox = "{{$connection_details['imap_host']}:{$connection_details['imap_port']}{$ssl}}";
     $inbox = "{$mailbox}{$connection_details['inbox']}";
     $archive_box = "{$mailbox}{$connection_details['archive']}";
     $imap_connection = imap_open($mailbox, $connection_details['username'], $connection_details['password']);
     $redacted_connection_details = $connection_details;
     $redacted_connection_details['password'] = '[redacted]';
     // redact the password to avoid unnecessarily exposing it in logs
     $imap_errors = imap_errors();
     SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, $imap_connection ? __('Successfully opened IMAP connection.', 'supportflow') : __('Failed to open IMAP connection.', 'supportflow'), compact('redacted_connection_details', 'mailbox', 'imap_errors'));
     if (!$imap_connection) {
         return new WP_Error('connection-error', __('Error connecting to mailbox', 'supportflow'));
     }
     // Check to see if the archive mailbox exists, and create it if it doesn't
     $mailboxes = imap_getmailboxes($imap_connection, $mailbox, '*');
     if (!wp_filter_object_list($mailboxes, array('name' => $archive_box))) {
         imap_createmailbox($imap_connection, $archive_box);
     }
     // Make sure here are new emails to process
     $email_count = imap_num_msg($imap_connection);
     if ($email_count < 1) {
         SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, __('No new messages to process.', 'supportflow'), compact('mailboxes'));
         return false;
     }
     $emails = imap_search($imap_connection, 'ALL', SE_UID);
     $email_count = min($email_count, apply_filters('supportflow_max_email_process_count', 20));
     $emails = array_slice($emails, 0, $email_count);
     $processed = 0;
     // Process each new email and put it in the archive mailbox when done.
     foreach ($emails as $uid) {
         $email = new stdClass();
         $email->uid = $uid;
         $email->msgno = imap_msgno($imap_connection, $email->uid);
         $email->headers = imap_headerinfo($imap_connection, $email->msgno);
         $email->structure = imap_fetchstructure($imap_connection, $email->msgno);
         $email->body = $this->get_body_from_connection($imap_connection, $email->msgno);
         if (0 === strcasecmp($connection_details['username'], $email->headers->from[0]->mailbox . '@' . $email->headers->from[0]->host)) {
             $connection_details['password'] = '[redacted]';
             // redact the password to avoid unnecessarily exposing it in logs
             SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, __('Skipping message because it was sent from a SupportFlow account.', 'supportflow'), compact('email'));
             continue;
         }
         // @todo Confirm this a message we want to process
         $result = $this->process_email($imap_connection, $email, $email->msgno, $connection_details['username'], $connection_details['account_id']);
         // If it was successful, move the email to the archive
         if ($result) {
             imap_mail_move($imap_connection, $email->uid, $connection_details['archive'], CP_UID);
             $processed++;
         }
     }
     imap_close($imap_connection, CL_EXPUNGE);
     $status_message = sprintf(__('Processed %d emails', 'supportflow'), $processed);
     SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, $status_message);
     return $status_message;
 }
开发者ID:nagyistoce,项目名称:supportflow,代码行数:62,代码来源:class-supportflow-email-replies.php

示例5: getMailboxes

 public function getMailboxes($server, $str = "*")
 {
     $boxes = array();
     foreach (imap_getmailboxes($this->mbox, $server, $str) as $box) {
         $boxes[] = new Mailbox($box);
     }
     return $boxes;
 }
开发者ID:skrokbogumil,项目名称:KlientPoczty,代码行数:8,代码来源:mailService.php

示例6: getServerDelimiter

function getServerDelimiter()
{
    $list = @imap_getmailboxes($mbox, $server, "*");
    if (is_array($list) && count($list) > 0) {
        // get the delimiter from the first folder
        $delimiter = $list[0]->delimiter;
    } else {
        // default
        $delimiter = ".";
    }
    return $delimiter;
}
开发者ID:SvKn,项目名称:Z-Push-contrib,代码行数:12,代码来源:testing-imap_folder_list.php

示例7: getMailboxes

 public function getMailboxes()
 {
     if (empty($this->mailboxes)) {
         $mailboxes = imap_getmailboxes($this->connection, $this->resource, '*');
         foreach ($mailboxes as $item) {
             preg_match('#\\{(.*)\\}(.*)#', $item->name, $name);
             $mailbox = $name[0];
             $name = $name[2];
             $this->mailboxes[$name] = new Mailbox($this, $mailbox, $name);
         }
     }
     return $this->mailboxes;
 }
开发者ID:raccoonsoftware,项目名称:LaravelImap,代码行数:13,代码来源:Client.php

示例8: getFolders

 /**
  * Vrati pole vsetkych najdenych mailboxov na emailovom konte
  *
  * @return array
  * @throws Exception
  */
 public function getFolders()
 {
     $mbox = $this->openMailServerConnection();
     $result = array();
     $boxes = imap_getmailboxes($mbox, '{' . IMAP_HOST . '}', '*');
     if (is_array($boxes)) {
         foreach ($boxes as $key => $val) {
             $result[$key]['name'] = str_replace('{' . IMAP_HOST . '}', '', imap_utf7_decode($val->name));
             $result[$key]['delimiter'] = $val->delimiter;
             $result[$key]['attribs'] = $val->attributes;
             $Status = imap_status($mbox, $val->name, SA_ALL);
             $result[$key]['msgNum'] = $Status->messages;
             $result[$key]['newNum'] = isset($Status->recent) ? $Status->recent : 0;
             $result[$key]['unreadNum'] = isset($Status->unseen) ? $Status->unseen : 0;
         }
     } else {
         Logger::error("imap_getmailboxes() failed: " . imap_last_error());
     }
     //        imap_close($mbox);
     return $result;
 }
开发者ID:novacek78,项目名称:v4,代码行数:27,代码来源:ModelImapServer.php

示例9: globalDelete

 /**
  * Function to delete messages in a mailbox, based on date
  * NOTE: this is global ... will affect all mailboxes except any that have 'sent' in the mailbox name
  */
 public function globalDelete()
 {
     $dateArr = split('-', $this->deleteMsgDate);
     // date format is yyyy-mm-dd
     $delDate = mktime(0, 0, 0, $dateArr[1], $dateArr[2], $dateArr[0]);
     $port = $this->port . '/' . $this->service . '/' . $this->serviceOption;
     $mboxt = imap_open('{' . $this->mailhost . ":" . $port . '}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN);
     $list = imap_getmailboxes($mboxt, '{' . $this->mailhost . ":" . $port . '}', "*");
     $mailboxFound = false;
     if (is_array($list)) {
         foreach ($list as $key => $val) {
             // get the mailbox name only
             $nameArr = split('}', imap_utf7_decode($val->name));
             $nameRaw = $nameArr[count($nameArr) - 1];
             if (!stristr($nameRaw, 'sent')) {
                 $mboxd = imap_open('{' . $this->mailhost . ":" . $port . '}' . $nameRaw, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE);
                 $messages = imap_sort($mboxd, SORTDATE, 0);
                 $i = 0;
                 $check = imap_mailboxmsginfo($mboxd);
                 foreach ($messages as $message) {
                     $header = imap_header($mboxd, $message);
                     $fdate = date("F j, Y", $header->udate);
                     // purge if prior to global delete date
                     if ($header->udate < $delDate) {
                         imap_delete($mboxd, $message);
                     }
                     $i++;
                 }
                 imap_expunge($mboxd);
                 imap_close($mboxd);
             }
         }
     }
 }
开发者ID:natxet,项目名称:PHPMailer-BMH,代码行数:38,代码来源:BounceMailHandler.php

示例10: folders

 /**
  * Reads mail box folders
  * @param string $ref Optional -
  */
 public function folders($ref = "{folder}")
 {
     if ($this->mFolders) {
         return $this->mFolders;
     }
     $result = imap_getmailboxes($this->mBox, $ref, "*");
     if ($this->isError()) {
         return false;
     }
     $folders = array();
     foreach ($result as $row) {
         $folderName = str_replace($ref, "", $row->name);
         $folder = $this->convertCharacterEncoding($folderName, "UTF-8", "UTF7-IMAP");
         //Decode folder name
         $folders[] = $this->folderInstance($folder);
     }
     $this->mFolders = $folders;
     return $folders;
 }
开发者ID:Wasage,项目名称:werpa,代码行数:23,代码来源:Connector.php

示例11: folders

 /**
  * Reads mail box folders
  * @param string $ref Optional - 
  */
 function folders($ref = "{folder}")
 {
     if ($this->mFolders) {
         return $this->mFolders;
     }
     $result = imap_getmailboxes($this->mBox, $ref, "*");
     if ($this->isError()) {
         return false;
     }
     $folders = array();
     foreach ($result as $row) {
         $folders[] = $this->folderInstance(str_replace($ref, "", $row->name));
     }
     $this->mFolders = $folders;
     return $folders;
 }
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:20,代码来源:Connector.php

示例12: getMailBoxDetails

 /**
  * Return information about the mailbox or mailboxes
  *
  * @param $mailbox
  *
  * @return array
  */
 public function getMailBoxDetails($mailbox)
 {
     return imap_getmailboxes($this->getImapStream(), $this->getServerString(), $this->getServerSpecification() . $mailbox);
 }
开发者ID:kamaroly,项目名称:Fetch,代码行数:11,代码来源:Server.php

示例13: getMailBoxList

 protected function getMailBoxList()
 {
     if (!is_null($this->mailboxList)) {
         return $this->mailboxList;
     }
     $mailboxes = imap_getmailboxes($this->resource, $this->server, '*');
     $this->mailboxList = array();
     foreach ($mailboxes as $mailbox) {
         $name = str_replace($this->server, '', $mailbox->name);
         $this->mailboxList[$name] = $mailbox;
     }
     return $this->mailboxList;
 }
开发者ID:gbcogivea,项目名称:imap,代码行数:13,代码来源:Connection.php

示例14: isMailboxExist

 /**
  * Function to check if a mailbox exists
  * - if not found, it will create it
  * @param string  $mailbox        (the mailbox name, must be in 'INBOX.checkmailbox' format)
  * @param boolean $create         (whether or not to create the checkmailbox if not found, defaults to true)
  * @return boolean
  */
 function isMailboxExist($mailbox)
 {
     if (trim($mailbox) == '' || !strstr($mailbox, 'INBOX.')) {
         // this is a critical error with either the mailbox name blank or an invalid mailbox name
         // need to stop processing and exit at this point
         //echo "Invalid mailbox name for move operation. Cannot continue.<br />\n";
         //echo "TIP: the mailbox you want to move the message to must include 'INBOX.' at the start.<br />\n";
         return false;
     }
     $port = $this->port . '/' . $this->service . ($this->service_option != 'none' ? '/' . $this->service_option : '');
     $mbox = imap_open('{' . $this->mailhost . ":" . $port . '}', $this->mailbox_username, $this->mailbox_password, OP_HALFOPEN);
     $list = imap_getmailboxes($mbox, '{' . $this->mailhost . ":" . $port . '}', "*");
     $mailboxFound = false;
     if (is_array($list)) {
         foreach ($list as $key => $val) {
             // get the mailbox name only
             $nameArr = split('}', imap_utf7_decode($val->name));
             $nameRaw = $nameArr[count($nameArr) - 1];
             if ($mailbox == $nameRaw) {
                 $mailboxFound = true;
             }
         }
         //      if ( ($mailboxFound === false) && $create ) {
         //        @imap_createmailbox($mbox, imap_utf7_encode('{'.$this->mailhost.":".$port.'}' . $mailbox));
         //        imap_close($mbox);
         //        return true;
         //      } else {
         //        imap_close($mbox);
         //        return false;
         //      }
     } else {
         imap_close($mbox);
         return false;
     }
 }
开发者ID:Rikisha,项目名称:proj,代码行数:42,代码来源:lib.php

示例15: get_folder_list

 /**
  * Gets the folder list
  *
  * @access private
  * @return array
  */
 private function get_folder_list()
 {
     $folders = array();
     $list = @imap_getmailboxes($this->mbox, $this->server, "*");
     if (is_array($list)) {
         $list = array_reverse($list);
         foreach ($list as $l) {
             $folders[] = $l->name;
         }
     }
     return $folders;
 }
开发者ID:peterbeck,项目名称:Z-Push-contrib,代码行数:18,代码来源:imap.php


注:本文中的imap_getmailboxes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。