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


PHP imap_headers函数代码示例

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


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

示例1: messages

 public function messages($options = true)
 {
     if (is_bool($options)) {
         $options = array('seen' => $options);
     }
     $options = self::options($options, array('offset' => 0, 'limit' => 0, 'seen' => true, 'newestFirst' => true));
     $IMAPMessageClass = $this->IMAPMessageClass;
     $headers = imap_headers($this->mbox);
     if ($options['newestFirst']) {
         $headers = array_reverse($headers);
     }
     $messages = array();
     $eligables = 0;
     foreach ($headers as $n => $header) {
         if (preg_match('/(U?)\\s+(\\d+)\\)/', $header, $match)) {
             $unseen = (bool) trim($match[1]);
             $msgNum = (int) $match[2];
             $eligable = $options['seen'] || $unseen;
             if ($eligable) {
                 $eligables++;
             }
             if ($eligable) {
                 if ($eligables > $options['offset']) {
                     if (!$options['limit'] || !isset($messages[$options['limit'] - 1])) {
                         $messages[] = new $IMAPMessageClass($this, $msgNum, $header, $unseen);
                     }
                 }
             }
             if ($options['limit'] && isset($messages[$options['limit'] - 1])) {
                 break;
             }
         }
     }
     return $messages;
 }
开发者ID:renatomartins,项目名称:cognosys,代码行数:35,代码来源:IMAP.php

示例2: 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

示例3: total

 public function total()
 {
     if (!$this->box) {
         return 0;
     } else {
         return count(imap_headers($this->box));
     }
 }
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:8,代码来源:ReceiveImapDAO.php

示例4: imapcount

 function imapcount()
 {
     if (!$this->mbox) {
         return false;
     }
     $headers = imap_headers($this->mbox);
     return count($headers);
 }
开发者ID:sheagle,项目名称:mailreceiver,代码行数:8,代码来源:cls_email.php

示例5: __imap_count_mail

 function __imap_count_mail()
 {
     $this->headers = @imap_headers($this->conn);
     if (!empty($this->headers)) {
         return sizeof($this->headers);
     } else {
         return $this->imap_get_last_error();
     }
 }
开发者ID:hardikamutech,项目名称:campaign,代码行数:9,代码来源:_imap_helper.php

示例6: listMessages

 function listMessages()
 {
     return imap_headers($this->stream);
 }
开发者ID:kam1katze,项目名称:ocDashboard,代码行数:4,代码来源:imap.php

示例7: getTotalMails

 function getTotalMails()
 {
     $headers = imap_headers($this->marubox);
     return count($headers);
 }
开发者ID:rusoftware,项目名称:_NewSite,代码行数:5,代码来源:receivemail.class.php

示例8: imap_open

<?php

// open IMAP connection
$mail = imap_open('{mail.server.com:143}', 'username', 'password');
// or, open POP3 connection
$mail = imap_open('{mail.server.com:110/pop3}', 'username', 'password');
// grab a list of all the mail headers
$headers = imap_headers($mail);
// grab a header object for the last message in the mailbox
$last = imap_num_msg($mail);
$header = imap_header($mail, $last);
// grab the body for the same message
$body = imap_body($mail, $last);
// close the connection
imap_close($mail);
开发者ID:zmwebdev,项目名称:PHPcookbook-code-3ed,代码行数:15,代码来源:imap-pop-read.php

示例9: cw_order_messages_get_emails

function cw_order_messages_get_emails($time, $prev_time)
{
    global $tables, $config;
    global $take_messages_debug;
    /*
    $config['order_messages']['contact_email_access_info'] = '{pop.gmail.com:995/novalidate-cert/pop3/ssl}INBOX';
    */
    $mail = imap_open($config['order_messages']['contact_email_access_info'], $config['order_messages']['contact_email_address'], $config['order_messages']['contact_email_password']);
    /*cw_log_add("order_messages_get_emails",array('contact_email_access_info'=>$config['order_messages']['contact_email_access_info'],
      'contact_email_address'=>$config['order_messages']['contact_email_address'],
      'contact_email_password'=>'--hidden--'));*/
    if (!$mail) {
        //cw_log_add("order_messages_get_emails", array("imap last error: "=>imap_last_error()));
        if ($take_messages_debug == 'Y') {
            print_r(array("order_messages_get_emails", array("imap last error: " => imap_last_error())));
            print "<br>";
        }
    } else {
        if ($take_messages_debug == 'Y') {
            print_r(array("order_messages_get_emails", array("imap last error: " => imap_last_error(), "mail_obj" => $mail)));
            print "<br>";
        }
    }
    $last_mail_id = cw_query_first_cell("select max(mail_id) from {$tables['mail_rpool']}");
    if ($mail) {
        $headers = imap_headers($mail);
        if (!empty($headers)) {
            $curr_message_id = imap_num_msg($mail);
            while ($curr_message_id > 0) {
                $header = imap_header($mail, $curr_message_id);
                //do not save emails from anyone else but users
                $from = $header->from;
                foreach ($from as $id => $object) {
                    $emailfrom = $object->mailbox . "@" . $object->host;
                }
                $is_users_email = cw_query_first_cell("select count(*) from {$tables['customers']} where email='" . addslashes($emailfrom) . "'");
                if (!$is_users_email) {
                    $curr_message_id--;
                    continue;
                }
                // pull the plain text for message $n
                $st = imap_fetchstructure($mail, $curr_message_id);
                if (!empty($st->parts)) {
                    for ($i = 0, $j = count($st->parts); $i < $j; $i++) {
                        $part = $st->parts[$i];
                        if ($part->subtype == 'PLAIN') {
                            $body = imap_fetchbody($mail, $curr_message_id, $i + 1);
                        }
                    }
                } else {
                    $body = imap_body($mail, $curr_message_id);
                }
                $body = preg_replace('#(^\\w.+:\\n)?(^>.*(\\n|$))+#mi', "", $body);
                cw_array2insert('mail_rpool', array('header' => serialize($header), 'body' => addslashes($body), 'subject' => $header->subject, 'mail_from' => addslashes($emailfrom), 'mail_to' => $header->toaddress));
                cw_log_add('mail_rpool', array('header' => $header, 'subject' => $header->subject, 'mail_from' => $emailfrom, 'mail_to' => $header->toaddress, 'body' => $body));
                $curr_message_id--;
            }
        }
        imap_close($mail);
    }
    if ($last_mail_id) {
        $last_mail_id_condition = " where mail_id > '{$last_mail_id}' ";
    }
    if ($take_messages_debug != 'Y') {
        cw_order_messages_process_new_emails($last_mail_id_condition);
    }
    return;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:68,代码来源:func.php

示例10: getTotalMails

 /**
  * Used to get total unread mail from that mailbox
  *
  * @return an integer (Total Mail)
  **/
 function getTotalMails()
 {
     //Get Total Number off Unread Email In Mailbox
     $headers = imap_headers($this->marubox);
     return count($headers);
 }
开发者ID:remicollet,项目名称:glpi,代码行数:11,代码来源:mailcollector.class.php

示例11: imap_listmailbox

         } else {
             echo 'Не удалось открыть ящик';
         }
     }
     // if
     break;
     //////////////////////////////////////////////////
 //////////////////////////////////////////////////
 case 'mailboxes':
     // нет параметров
 // нет параметров
 case 'headers':
     // нет параметров
     //////////////////////////////////////////////////
     if ($mbi) {
         $r = $cmd == 'mailboxes' ? imap_listmailbox($mbi, $ibox['mailbox'], '*') : imap_headers($mbi);
         if ($r) {
             while (list($key, $val) = each($r)) {
                 echo "{$val}\n";
             }
         } else {
             echo 'Не получилось';
         }
     }
     // if
     break;
     //////////////////////////////////////////////////
 //////////////////////////////////////////////////
 case 'header':
     // $params - номер письма
     //////////////////////////////////////////////////
开发者ID:pombredanne,项目名称:lishnih,代码行数:31,代码来源:app_imap.php

示例12: imapHeaders

 /**
  * liefert die Mailheader
  * @return array
  */
 public function imapHeaders()
 {
     if ($this->imap === null) {
         throw new IMAPException(__METHOD__ . ' not connected');
     }
     $this->imapPing(true);
     return imap_headers($this->imap);
 }
开发者ID:NEOatNHNG,项目名称:cacert-testmgr,代码行数:12,代码来源:imapConnection.php

示例13: get_list

function get_list($imap)
{
    // get the list of messages in this mailbox
    $headers = imap_headers($imap);
    $messages = sizeof($headers);
    for ($i = 0; $i < $messages; $i++) {
        echo $headers[$i];
    }
    imap_close($imap);
}
开发者ID:andersonbporto,项目名称:programacao_internet_2015_1,代码行数:10,代码来源:mail_fns.php

示例14: getNumUnreadEmails

 function getNumUnreadEmails()
 {
     $headers = imap_headers($this->mailbox);
     return count($headers);
 }
开发者ID:sitracker,项目名称:sitracker_old,代码行数:5,代码来源:fetchSitMail.class.php

示例15: getTotalMails

 /**
  * Get Total Number off Unread Email In Mailbox
  * @return bool|int
  */
 public function getTotalMails()
 {
     if (!$this->marubox) {
         return false;
     } else {
         $headers = imap_headers($this->marubox);
         return count($headers);
     }
 }
开发者ID:lovecheng,项目名称:brs-demo2,代码行数:13,代码来源:Email.php


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