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


PHP imap_expunge函数代码示例

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


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

示例1: checkMessages

 /**
  * @param resource $imapConnection
  * @param array    $messages
  * @param bool     $clean
  *
  * @return bool Return <em>true</em> if <strong>all</strong> messages exist in the inbox.
  */
 public function checkMessages($imapConnection, array $messages, $clean = true)
 {
     $bodies = array_map(function ($message) {
         return $message->getText() . "\r\n";
     }, $messages);
     $host = $_ENV['AVISOTA_TEST_IMAP_HOST'] ?: getenv('AVISOTA_TEST_IMAP_HOST');
     $hits = 0;
     for ($i = 0; $i < 30 && $hits < count($bodies); $i++) {
         // wait for the mail server
         sleep(2);
         imap_gc($imapConnection, IMAP_GC_ENV);
         $status = imap_status($imapConnection, '{' . $host . '}', SA_MESSAGES);
         for ($j = $status->messages; $j > 0; $j--) {
             $body = imap_body($imapConnection, $j);
             if (in_array($body, $bodies)) {
                 $hits++;
                 if ($clean) {
                     imap_delete($imapConnection, $j);
                 }
             }
         }
         imap_expunge($imapConnection);
     }
     return $hits;
 }
开发者ID:avisota,项目名称:core,代码行数:32,代码来源:ImapMailboxChecker.php

示例2: move

 function move($uid, $folder)
 {
     $tries = 0;
     while ($tries++ < 3) {
         if (imap_mail_move($this->stream, $uid, $folder, CP_UID)) {
             imap_expunge($this->stream);
             return true;
         } else {
             sleep(1);
         }
     }
     return false;
 }
开发者ID:optimumweb,项目名称:php-email-reader-parser,代码行数:13,代码来源:email_reader.php

示例3: __destruct

 /**
  * Disconnects the current IMAP connection.
  */
 public function __destruct()
 {
     if ($this->ressource) {
         imap_expunge($this->ressource);
         imap_close($this->ressource);
     }
 }
开发者ID:nextglory,项目名称:CacoCloud,代码行数:10,代码来源:IMAP.php

示例4: Close

 /**
  * Close the connection to the mail server
  *
  * @param bool $empty_trash (default true) whether to empty the trash upon exit
  *
  */
 function Close($empty_trash = true)
 {
     if ($this->do_delete && $empty_trash) {
         imap_expunge($this->mbox);
     }
     imap_close($this->mbox);
 }
开发者ID:hpazevedo,项目名称:Teste-BDR,代码行数:13,代码来源:Pop3Client.php

示例5: deleteMessages

function deleteMessages($messages)
{
    $mbox = getMbox();
    $messages = uidToSecuence($mbox, $messages);
    imap_delete($mbox, $messages);
    imap_expunge($mbox);
    imap_close($mbox);
}
开发者ID:palako,项目名称:mobilewebmail,代码行数:8,代码来源:performaction.php

示例6: move

 function move($msg_index, $folder = 'INBOX.Processed')
 {
     // move on server
     imap_mail_move($this->conn, $msg_index, $folder);
     imap_expunge($this->conn);
     // re-read the inbox
     $this->inbox();
 }
开发者ID:networksoft,项目名称:erp.multinivel,代码行数:8,代码来源:Email_reader.php

示例7: delete

 public function delete($msg_index)
 {
     // move on server
     imap_delete($this->conn, $msg_index);
     imap_expunge($this->conn);
     // re-read the inbox
     $this->inbox();
 }
开发者ID:evo42,项目名称:willzahlen.at,代码行数:8,代码来源:mail-process.php

示例8: _disconnect

 private static function _disconnect()
 {
     if (!self::$_conn) {
         return;
     }
     imap_expunge(self::$_conn);
     imap_close(self::$_conn);
     self::$_conn = null;
 }
开发者ID:kylebragger,项目名称:Mailman,代码行数:9,代码来源:mailman.php

示例9: disconnect

 private function disconnect()
 {
     if (!$this->handle) {
         return;
     }
     //deletes all mails marked for deletion
     imap_expunge($this->handle);
     imap_close($this->handle);
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:9,代码来源:ImapReader.php

示例10: deleteMessage

 public function deleteMessage($id)
 {
     $status = imap_setflag_full($this->mailbox, $id, '\\Deleted');
     imap_expunge($this->mailbox);
     header("Location: /");
     /* Redirect browser */
     /* Make sure that code below does not get executed when we redirect. */
     return $status;
 }
开发者ID:charvoa,项目名称:Epitech-2,代码行数:9,代码来源:imapClass.php

示例11: delete

 function delete($stream, $msg_num, $flags = 0)
 {
     // do we force use of msg UID's
     if ($this->force_msg_uids == True && !($flags & FT_UID)) {
         $flags |= FT_UID;
     }
     $retval = imap_delete($stream, $msg_num, $flags);
     // some lame pop3 servers need this extra call to expunge, but RFC says not necessary
     imap_expunge($stream);
     return $retval;
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:11,代码来源:class.mail_dcom_pop3.inc.php

示例12: process

 /**
  * Process emails by invoking of callback processing function.
  * @param $callback function Function which should be executed for every email. This function should take an Email object as a parameter and return boolean as a result of processing.
  * @param $senders list of comma-separated emails/names. This parameter is optional and is used to filter incoming mail by senders. false by default.
  * @param $should_delete boolean Optional parameter. If this parameter is true and callback function returned true, email will be deleted.
  */
 public function process($callback, $senders = false, $should_delete = false)
 {
     if ($senders) {
         $senders = split(",", $senders);
     }
     if (is_array($senders) && !empty($senders)) {
         foreach ($senders as $sender) {
             if ($sender == '') {
                 continue;
             }
             $this->_process('FROM "' . $sender . '"', $callback, $should_delete);
         }
     } else {
         $this->_process('ALL', $callback, $should_delete);
     }
     imap_expunge($this->connection);
 }
开发者ID:HeuristNetwork,项目名称:heurist,代码行数:23,代码来源:classEmailProcessor.php

示例13: getdata

 function getdata($host, $login, $password, $savedirpath)
 {
     $this->savedDirPath = $savedirpath;
     $this->attachmenttype = array("text", "multipart", "message", "application", "audio", "image", "video", "other");
     // create empty array to store message data
     $this->importedMessageDataArray = array();
     // open the mailbox
     $mailbox = "{" . $host . ":143/imap/notls}INBOX";
     $this->mbox = imap_open($mailbox, $login, $password);
     if ($this->mbox == FALSE) {
         return null;
     }
     $status = imap_status($this->mbox, $mailbox, SA_ALL);
     echo "Messages: ", $status->messages, "<BR>\n";
     echo "Recent: ", $status->recent, "<BR>\n";
     echo "Unseen: ", $status->unseen, "<BR>\n";
     echo "UIDnext: ", $status->uidnext, "<BR>\n";
     echo "UIDvalidity: ", $status->uidvalidity, "<BR>\n";
     echo "Flags: ", $status->flags, "<BR>\n";
     // now itterate through messages
     for ($mid = imap_num_msg($this->mbox); $mid >= 1; $mid--) {
         $header = imap_header($this->mbox, $mid);
         $this->importedMessageDataArray[$mid]["subject"] = property_exists($header, 'subject') ? $header->subject : "";
         $this->importedMessageDataArray[$mid]["fromaddress"] = property_exists($header, 'fromaddress') ? $header->fromaddress : "";
         $this->importedMessageDataArray[$mid]["date"] = property_exists($header, 'date') ? $header->date : "";
         $this->importedMessageDataArray[$mid]["body"] = "";
         $this->structureObject = imap_fetchstructure($this->mbox, $mid);
         $this->saveAttachments($mid);
         $this->getBody($mid);
         imap_delete($this->mbox, $mid);
         //imap_delete tags a message for deletion
     }
     // for multiple messages
     imap_expunge($this->mbox);
     // imap_expunge deletes all tagged messages
     imap_close($this->mbox);
     // now send the data to the server
     $this->exportEntries();
     return $this->importedMessageDataArray;
 }
开发者ID:DBezemer,项目名称:server,代码行数:40,代码来源:___myMailAttachmentImporter.class.php

示例14: while

    while ($a = $ie->db->fetchByAssoc($r)) {
        $ieX = new InboundEmail();
        $ieX->retrieve($a['id']);
        $ieX->connectMailserver();
        //$newMsgs = $ieX->getNewMessageIds();
        $newMsgs = array();
        if ($ieX->isPop3Protocol()) {
            $newMsgs = $ieX->getPop3NewMessagesToDownload();
        } else {
            $newMsgs = $ieX->getNewMessageIds();
        }
        if (is_array($newMsgs)) {
            foreach ($newMsgs as $k => $msgNo) {
                $uid = $msgNo;
                if ($ieX->isPop3Protocol()) {
                    $uid = $ieX->getUIDLForMessage($msgNo);
                } else {
                    $uid = imap_uid($ieX->conn, $msgNo);
                }
                // else
                $ieX->importOneEmail($msgNo, $uid);
            }
        }
        imap_expunge($ieX->conn);
        imap_close($ieX->conn);
    }
    header('Location: index.php?module=Emails&action=ListViewGroup');
} else {
    // fail gracefully
    header('Location: index.php?module=Emails&action=index');
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:Check.php

示例15: chamado_mail


//.........这里部分代码省略.........
                         }
                         $h .= $c < count($headers->cc) - 1 ? '; ' : '';
                     }
                     $h .= "<br />\n";
                 }
                 $headers->subject = strip_tags($headers->subject);
                 #if($controle_id_empresa == 1 && $controle_id_usuario == 1){
                 if (substr_count($headers->subject, 'iso-8859-1') > 0) {
                     $subject = imap_mime_header_decode($headers->subject);
                     $headers->subject = $subject[0]->text;
                 }
                 #}
                 $h .= "<b>Enviada em: </b>" . $headers->date . "<br />\n";
                 $h .= "<b>Assunto: </b>" . $headers->subject . "<br /><br />\n\n";
                 $msg = imap_qprint(imap_body($mbox, $i));
                 $msg = strip_tags($msg);
                 if (substr_count($msg, 'Content-ID') > 0) {
                     $msg = explode("Content-ID", $msg);
                     $msg = explode("\n", $msg[0]);
                 } else {
                     $msg = explode("\n", $msg);
                 }
                 $mensagem = '';
                 for ($k = 0; $k < count($msg); $k++) {
                     $msg[$k] = str_replace('&nbsp;', ' ', $msg[$k]);
                     $msg[$k] = trim($msg[$k]);
                     if (strlen(trim($msg[$k])) > 0) {
                         $cont = $this->LimparLinha($msg[$k]);
                         if ($cont == 0 && strlen(trim($msg[$k])) > 0) {
                             if (substr_count($msg[$k], 'De: ') > 0) {
                                 if (substr_count($msg[$k], '@cartoriopostal.com.br') > 0 || substr_count($msg[$k], '@softfox.com.br') > 0 || substr_count($msg[$k], '@sistecart.com.br') > 0 || substr_count($msg[$k], '@seupetcomsobrenome.com.br') > 0 || substr_count($msg[$k], '@franchiseemporium.com.br') > 0) {
                                     $k = count($msg);
                                 } else {
                                     $mensagem .= $msg[$k] . "<br /><br />\n\n";
                                 }
                             } else {
                                 $mensagem .= $msg[$k] . "<br /><br />\n\n";
                             }
                         }
                     }
                 }
                 # **************************************************************
                 if (strlen($mensagem) > 0) {
                     #if($controle_id_empresa == 1 && $controle_id_usuario == 1){
                     $mensagem = $h . $mensagem;
                     $stt = substr_count(strtolower($headers->subject), '| aberto') == 0 || ubstr_count(strtolower($headers->subject), '|aberto') == 0 ? 1 : 0;
                     $headers->subject = str_replace('| aberto', '', $headers->subject);
                     $headers->subject = str_replace('|aberto', '', $headers->subject);
                     $headers->subject = str_replace('RES: ', '', $headers->subject);
                     $headers->subject = trim($headers->subject);
                     # **************************************************************
                     $this->sql = "SELECT c.* FROM vsites_chamado AS c WHERE \n\t\t\t\t\t\t\t\t(c.pergunta LIKE '%" . $headers->subject . "%') AND c.id_empresa = ? AND c.id_usuario = ?";
                     $this->values = array($empresa, $usuario);
                     $dt = $this->fetch();
                     if (count($dt) == 0) {
                         $this->fields = array('id_pedido', 'ordem', 'id_empresa', 'id_usuario', 'status', 'pergunta', 'resposta', 'data_cadastro', 'data_atualizacao', 'forma_atend');
                         $this->values = array('id_pedido' => 0, 'ordem' => 0, 'id_empresa' => $empresa, 'id_usuario' => $usuario, 'status' => $stt, 'pergunta' => $headers->subject, 'resposta' => $mensagem, 'data_cadastro' => $data, 'data_atualizacao' => $data, 'forma_atend' => 2);
                         if ($controle_id_empresa == 1 && $controle_id_usuario == 1) {
                             $dt = $this->insert();
                         } else {
                             $this->insert();
                             #comentar se precisar
                         }
                     } else {
                         if ($dt[0]->status == 0) {
                             $sql = 'UPDATE ' . $this->table . ' SET status=?, data_atualizacao=?, pergunta=?, resposta=? ';
                             $sql .= 'WHERE id_chamado = ?';
                             $this->sql = $sql;
                             $this->values = array($stt, date('Y-m-d H:i:s'), $headers->subject, $mensagem . $dt[0]->resposta, $dt[0]->id_chamado);
                             if ($controle_id_empresa == 1 && $controle_id_usuario == 1) {
                                 $dt = $this->exec();
                             } else {
                                 $this->exec();
                                 #comentar se precisar
                             }
                         }
                     }
                     #}
                 }
                 #echo $mensagem."\n\n\n";
             }
             if ($controle_id_empresa == 1 && $controle_id_usuario == 1) {
                 #$headers = imap_header($mbox, $i);
                 #$teste = imap_headerinfo($mbox, $i);
                 #print_r($teste); echo "\n\n";
                 print_r(imap_errors());
                 exit;
                 imap_delete($mbox, $i);
                 print_r(imap_errors());
                 echo $headers->message_id;
             }
         }
         if ($controle_id_empresa == 1 && $controle_id_usuario == 1) {
             imap_expunge($mbox);
         }
     }
     if ($controle_id_empresa == 1 && $controle_id_usuario == 1) {
         imap_close($mbox);
     }
 }
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:101,代码来源:ChamadoDAO.php


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