本文整理汇总了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;
}
示例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'));
}
示例3: total
public function total()
{
if (!$this->box) {
return 0;
} else {
return count(imap_headers($this->box));
}
}
示例4: imapcount
function imapcount()
{
if (!$this->mbox) {
return false;
}
$headers = imap_headers($this->mbox);
return count($headers);
}
示例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();
}
}
示例6: listMessages
function listMessages()
{
return imap_headers($this->stream);
}
示例7: getTotalMails
function getTotalMails()
{
$headers = imap_headers($this->marubox);
return count($headers);
}
示例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);
示例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;
}
示例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);
}
示例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 - номер письма
//////////////////////////////////////////////////
示例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);
}
示例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);
}
示例14: getNumUnreadEmails
function getNumUnreadEmails()
{
$headers = imap_headers($this->mailbox);
return count($headers);
}
示例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);
}
}