本文整理汇总了PHP中imap_expunge函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_expunge函数的具体用法?PHP imap_expunge怎么用?PHP imap_expunge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_expunge函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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(' ', ' ', $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
示例16: check_mailbox
protected function check_mailbox()
{
imap_ping($this->conn);
$count = imap_num_msg($this->conn);
common_log(LOG_INFO, "Found {$count} messages");
if ($count > 0) {
$handler = new IMAPMailHandler();
for ($i = 1; $i <= $count; $i++) {
$rawmessage = imap_fetchheader($this->conn, $count, FT_PREFETCHTEXT) . imap_body($this->conn, $i);
$handler->handle_message($rawmessage);
imap_delete($this->conn, $i);
}
imap_expunge($this->conn);
common_log(LOG_INFO, "Finished processing messages");
}
return $count;
}
开发者ID:Br3nda,项目名称:StatusNet,代码行数:17,代码来源:imapmanager.php
示例17: expungeDeletedMails
/**
* Deletes all the mails marked for deletion by imap_delete(), imap_mail_move(), or imap_setflag_full().
* @return bool
*/
public function expungeDeletedMails()
{
return imap_expunge($this->getImapStream());
}
开发者ID:ladybirdweb,项目名称:momo-email-listener,代码行数:8,代码来源:Mailbox.php
示例18: fetchEmails
function fetchEmails()
{
if (!$this->connect()) {
return false;
}
$archiveFolder = $this->getArchiveFolder();
$delete = $this->canDeleteEmails();
$max = $this->getMaxFetch();
$nummsgs = imap_num_msg($this->mbox);
//echo "New Emails: $nummsgs\n";
$msgs = $errors = 0;
for ($i = $nummsgs; $i > 0; $i--) {
//process messages in reverse.
if ($this->createTicket($i)) {
imap_setflag_full($this->mbox, imap_uid($this->mbox, $i), "\\Seen", ST_UID);
//IMAP only??
if ((!$archiveFolder || !imap_mail_move($this->mbox, $i, $archiveFolder)) && $delete) {
imap_delete($this->mbox, $i);
}
$msgs++;
$errors = 0;
//We are only interested in consecutive errors.
} else {
$errors++;
}
if ($max && ($msgs >= $max || $errors > $max * 0.8)) {
break;
}
}
//Warn on excessive errors
if ($errors > $msgs) {
$warn = sprintf(_S('Excessive errors processing emails for %1$s/%2$s. Please manually check the inbox.'), $this->getHost(), $this->getUsername());
$this->log($warn);
}
@imap_expunge($this->mbox);
return $msgs;
}
开发者ID:KM-MFG,项目名称:osTicket-1.8,代码行数:37,代码来源:class.mailfetch.php
示例19: delete
/**
* Delete
*
* @created: 15.10.2008 18:35:38
* @param type $var
*
*/
public function delete(&$model)
{
// debug("ImapSource::delete({$model->id})");
// debug(func_get_args());
// die();
if ($this->connected) {
$id = $model->id;
imap_delete($this->connection, $id);
imap_expunge($this->connection);
return true;
}
return false;
}
开发者ID:John-Henrique,项目名称:RF,代码行数:20,代码来源:imap_source.php
示例20: collect
//.........这里部分代码省略.........
//If entity assigned, or email refused by rule, or no user and no supplier associated with the email
$user_condition = $CFG_GLPI["use_anonymous_helpdesk"] || isset($tkt['_users_id_requester']) && $tkt['_users_id_requester'] > 0 || isset($tkt['_supplier_email']) && $tkt['_supplier_email'];
$rejinput = array();
$rejinput['mailcollectors_id'] = $mailgateID;
if (!$tkt['_blacklisted']) {
$rejinput['from'] = $tkt['_head']['from'];
$rejinput['to'] = $tkt['_head']['to'];
$rejinput['users_id'] = $tkt['_users_id_requester'];
$rejinput['subject'] = $this->textCleaner($tkt['_head']['subject']);
$rejinput['messageid'] = $tkt['_head']['message_id'];
}
$rejinput['date'] = $_SESSION["glpi_currenttime"];
// Manage blacklisted emails
if (isset($tkt['_blacklisted']) && $tkt['_blacklisted']) {
$this->deleteMails($i, self::REFUSED_FOLDER);
$blacklisted++;
// entities_id set when new ticket / tickets_id when new followup
} else {
if ((isset($tkt['entities_id']) || isset($tkt['tickets_id'])) && $user_condition || isset($tkt['_refuse_email_no_response']) || isset($tkt['_refuse_email_with_response'])) {
if (isset($tkt['_refuse_email_with_response'])) {
$this->sendMailRefusedResponse($tkt['_head']['from'], $tkt['name']);
$delete_mail = self::REFUSED_FOLDER;
$refused++;
} else {
if (isset($tkt['_refuse_email_no_response'])) {
$delete_mail = self::REFUSED_FOLDER;
$refused++;
} else {
if (isset($tkt['entities_id']) || isset($tkt['tickets_id'])) {
// Is a mail responding of an already existing ticket ?
if (isset($tkt['tickets_id'])) {
$fup = new TicketFollowup();
if ($fup->add($tkt)) {
$delete_mail = self::ACCEPTED_FOLDER;
} else {
$error++;
$rejinput['reason'] = NotImportedEmail::FAILED_INSERT;
$rejected->add($rejinput);
}
} else {
// New ticket
$track = new Ticket();
if ($track->add($tkt)) {
$delete_mail = self::ACCEPTED_FOLDER;
} else {
$error++;
$rejinput['reason'] = NotImportedEmail::FAILED_INSERT;
$rejected->add($rejinput);
}
}
} else {
// Case never raise
$delete_mail = self::REFUSED_FOLDER;
$refused++;
}
}
}
//Delete Mail from Mail box if ticket is added successfully
if ($delete_mail) {
$this->deleteMails($i, $delete_mail);
}
} else {
if (!$tkt['_users_id_requester']) {
$rejinput['reason'] = NotImportedEmail::USER_UNKNOWN;
} else {
$rejinput['reason'] = NotImportedEmail::MATCH_NO_RULE;
}
$rejected->add($rejinput);
}
}
$this->fetch_emails++;
}
imap_expunge($this->marubox);
$this->close_mailbox();
//Close Mail Box
//TRANS: %1$d, %2$d, %3$d, %4$d and %5$d are number of messages
$msg = sprintf(__('Number of messages: available=%1$d, retrieved=%2$d, refused=%3$d, errors=%4$d, blacklisted=%5$d'), $tot, $this->fetch_emails, $refused, $error, $blacklisted);
if ($display) {
Session::addMessageAfterRedirect($msg, false, $error ? ERROR : INFO);
} else {
return $msg;
}
} else {
$msg = __('Could not connect to mailgate server');
if ($display) {
Session::addMessageAfterRedirect($msg, false, ERROR);
} else {
return $msg;
}
}
} else {
//TRANS: %s is the ID of the mailgate
$msg = sprintf(__('Could not find mailgate %d'), $mailgateID);
if ($display) {
Session::addMessageAfterRedirect($msg, false, ERROR);
} else {
return $msg;
}
}
}
开发者ID:remicollet,项目名称:glpi,代码行数:101,代码来源:mailcollector.class.php
注:本文中的imap_expunge函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论