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


PHP imap_mail_move函数代码示例

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


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

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

示例2: moveMailToFolder

 /**
  * @param $mail_id
  * @param string $folder
  */
 public function moveMailToFolder($mail_id, $folder = 'INBOX/Junk')
 {
     $imapresult = imap_mail_move($this->getImapStream(), $mail_id, $folder, CP_UID);
     if (!$imapresult) {
         echo imap_last_error();
     }
 }
开发者ID:pnoreck,项目名称:mailscanner,代码行数:11,代码来源:Mailbox.php

示例3: fetch

 public function fetch(MailCriteria $criteria, $callback)
 {
     $mailbox = @imap_open('{' . $this->host . ':' . $this->port . '}INBOX', $this->username, $this->password);
     if (!$mailbox) {
         throw new ImapException("Cannot connect to imap server: {$this->host}:{$this->port}'");
     }
     $this->checkProcessedFolder($mailbox);
     $emails = $this->fetchEmails($mailbox, $criteria);
     if ($emails) {
         foreach ($emails as $emailIndex) {
             $overview = imap_fetch_overview($mailbox, $emailIndex, 0);
             $message = imap_body($mailbox, $emailIndex);
             $email = new Email($overview, $message);
             $processed = $callback($email);
             if ($processed) {
                 $res = imap_mail_move($mailbox, $emailIndex, $this->processedFolder);
                 if (!$res) {
                     throw new \Exception("Unexpected error: Cannot move email to ");
                     break;
                 }
             }
         }
     }
     @imap_close($mailbox);
 }
开发者ID:martinstrycek,项目名称:imap-mail-downloader,代码行数:25,代码来源:Downloader.php

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

示例5: moveMail

 public function moveMail($mailId)
 {
     $imapresult = imap_mail_move($this->getImapStream(), $mailId, 'INBOX.Archive') && $this->expungeDeletedMails();
     if ($imapresult == false) {
         error_log(imap_last_error());
     }
     return $imapresult;
 }
开发者ID:escobar022,项目名称:wp_mailman,代码行数:8,代码来源:receivemail.class.php

示例6: mailcwp_delete_callback

function mailcwp_delete_callback()
{
    $result = array();
    $mailcwp_session = mailcwp_get_session();
    if (!isset($mailcwp_session) || empty($mailcwp_session)) {
        return;
    }
    $account = $mailcwp_session["account"];
    $use_ssl = $account["use_ssl"];
    //$from = $account["email"];
    $folder = $mailcwp_session["folder"];
    $use_tls = $account["use_tls"];
    $messages = $_POST["messages"];
    //write_log($messages);
    //write_log("DELETE MAIL " . print_r($account, true));
    $use_ssl_flag = $use_ssl === "true" ? "/ssl" : "";
    $use_tls_flag = $use_tls === "true" ? "/tls" : "";
    $mbox = mailcwp_imap_connect($account, 0, $folder);
    //write_log("SEND ACCOUNT " . print_r($account));
    $sent_folder = "";
    if (is_array($account)) {
        $trash_folder = $account["trash_folder"];
        if (empty($trash_folder)) {
            $trash_folder = mailcwp_find_folder($mbox, $account, "Trash");
            if (empty($trash_folder)) {
                $trash_folder = mailcwp_find_folder($mbox, $account, "Deleted");
            }
        }
        if (!empty($trash_folder) && $trash_folder != $folder) {
            //write_log("DELETE MOVE MESSAGES " . print_r($messages, true));
            imap_mail_move($mbox, $messages, $trash_folder);
            imap_expunge($mbox);
            $result["result"] = "OK";
            $result["message"] = "Moved to {$trash_folder}";
            $result["imap_errors"] = imap_errors();
        } else {
            imap_setflag_full($mbox, $messages, "\\Deleted");
            $result["result"] = "OK";
            if (!empty($trash_folder) && $folder == $trash_folder) {
                imap_expunge($mbox);
                $result["message"] = "Permanently Deleted";
            } else {
                $result["message"] = "Marked as Deleted";
            }
            $result["imap_errors"] = imap_errors();
        }
    } else {
        $result["result"] = "Failed";
        $result["message"] = "Account not found.";
    }
    //write_log("DELETE MESSAGES ($messages) " . print_r(imap_errors(), true));
    echo json_encode($result);
    die;
}
开发者ID:TouTrix,项目名称:mailcwp,代码行数:54,代码来源:mailcwp.php

示例7: getmails

 /**
  * @name: getmails
  * holt x Mails aus dem Postfach und parst diese nach Parts, oder sucht nur nach $subject
  *
  * @param $subject
  * @return Boolean
  */
 public function getmails($subject = 0)
 {
     imap_expunge($this->connection);
     $check = imap_mailboxmsginfo($this->connection);
     if (isset($subject) && !empty($subject)) {
         $mails = imap_search($this->connection, 'UNSEEN SUBJECT "' . substr(urldecode(subject), 0, 45) . '"', SE_UID);
     } else {
         $mails[0] = '*';
     }
     $mails = imap_fetch_overview($this->connection, "1:" . $mails[0], FT_UID);
     // Holt eine Uebersicht aller Emails
     $size = count($mails);
     // Anzahl der Nachrichten
     if ($size >= $this->config['counter']) {
         $size = $this->config['counter'];
     }
     for ($i = 0; $i < $size; $i++) {
         if ($i >= $this->config['counter']) {
             break;
         }
         $mails[$i]->subject = imap_utf8($mails[$i]->subject);
         $header = imap_fetchheader($this->connection, $mails[$i]->msgno);
         $struct = imap_fetchstructure($this->connection, $mails[$i]->msgno);
         $report = imap_fetchbody($this->connection, $mails[$i]->msgno, 2);
         $body = imap_fetchbody($this->connection, $mails[$i]->msgno, 1);
         $logs = imap_fetchbody($this->connection, $mails[$i]->msgno, 3);
         $this->mail[$i] = array('header' => $header, 'body' => $body, 'report' => $report, 'logs' => $logs, 'structur' => $struct, 'all' => $mails[$i]);
         $this->msgnr = $mails[$i]->msgno;
         if ($this->config['afterparse'] == 'delete') {
             imap_delete($this->connection, $mails[$i]->msgno . ':*');
         } elseif ($this->config['afterparse'] == 'move') {
             imap_mail_move($this->connection, $mails[$i]->msgno, $config['ordner'] . '.' . $this->config['movebox']);
         }
     }
     if ($this->config['afterparse'] == 'delete_all') {
         imap_delete($this->connection, "*");
     }
     imap_expunge($this->connection);
     if (!is_array($mails)) {
         $this->mail = 0;
     }
     return $this->mail;
 }
开发者ID:aalmenar,项目名称:validatexarf,代码行数:50,代码来源:validator.class.php

示例8: processMailbox


//.........这里部分代码省略.........
                     }
         */
         // fetch the messages one at a time
         if ($this->useFetchstructure) {
             $structure = imap_fetchstructure($this->mailboxLink, $x);
             if ($structure->type == 1 && $structure->ifsubtype && $structure->subtype == 'REPORT' && $structure->ifparameters && $this->isParameter($structure->parameters, 'REPORT-TYPE', 'delivery-status')) {
                 $processed = $this->processBounce($x, 'DSN', $totalCount);
             } else {
                 // not standard DSN msg
                 $this->output('Msg #' . $x . ' is not a standard DSN message', self::VERBOSE_REPORT);
                 if ($this->debugBodyRule) {
                     if ($structure->ifdescription) {
                         $this->output("  Content-Type : {$structure->description}", self::VERBOSE_DEBUG);
                     } else {
                         $this->output("  Content-Type : unsupported", self::VERBOSE_DEBUG);
                     }
                 }
                 $processed = $this->processBounce($x, 'BODY', $totalCount);
             }
         } else {
             $header = imap_fetchheader($this->mailboxLink, $x);
             // Could be multi-line, if the new line begins with SPACE or HTAB
             if (preg_match("/Content-Type:((?:[^\n]|\n[\t ])+)(?:\n[^\t ]|\$)/is", $header, $match)) {
                 if (preg_match("/multipart\\/report/is", $match[1]) && preg_match("/report-type=[\"']?delivery-status[\"']?/is", $match[1])) {
                     // standard DSN msg
                     $processed = $this->processBounce($x, 'DSN', $totalCount);
                 } else {
                     // not standard DSN msg
                     $this->output('Msg #' . $x . ' is not a standard DSN message', self::VERBOSE_REPORT);
                     if ($this->debugBodyRule) {
                         $this->output("  Content-Type : {$match[1]}", self::VERBOSE_DEBUG);
                     }
                     $processed = $this->processBounce($x, 'BODY', $totalCount);
                 }
             } else {
                 // didn't get content-type header
                 $this->output('Msg #' . $x . ' is not a well-formatted MIME mail, missing Content-Type', self::VERBOSE_REPORT);
                 if ($this->debugBodyRule) {
                     $this->output('  Headers: ' . $this->bmhNewLine . $header . $this->bmhNewLine, self::VERBOSE_DEBUG);
                 }
                 $processed = $this->processBounce($x, 'BODY', $totalCount);
             }
         }
         $deleteFlag[$x] = false;
         $moveFlag[$x] = false;
         if ($processed) {
             $processedCount++;
             if (!$this->disableDelete) {
                 // delete the bounce if not in disableDelete mode
                 if (!$this->testMode) {
                     @imap_delete($this->mailboxLink, $x);
                 }
                 $deleteFlag[$x] = true;
                 $deletedCount++;
             } elseif ($this->moveHard) {
                 // check if the move directory exists, if not create it
                 if (!$this->testMode) {
                     $this->mailboxExist($this->hardMailbox);
                 }
                 // move the message
                 if (!$this->testMode) {
                     @imap_mail_move($this->mailboxLink, $x, $this->hardMailbox);
                 }
                 $moveFlag[$x] = true;
                 $movedCount++;
             } elseif ($this->moveSoft) {
                 // check if the move directory exists, if not create it
                 if (!$this->testMode) {
                     $this->mailboxExist($this->softMailbox);
                 }
                 // move the message
                 if (!$this->testMode) {
                     @imap_mail_move($this->mailboxLink, $x, $this->softMailbox);
                 }
                 $moveFlag[$x] = true;
                 $movedCount++;
             }
         } else {
             // not processed
             $unprocessedCount++;
             if (!$this->disableDelete && $this->purgeUnprocessed) {
                 // delete this bounce if not in disableDelete mode, and the flag BOUNCE_PURGE_UNPROCESSED is set
                 if (!$this->testMode) {
                     @imap_delete($this->mailboxLink, $x);
                 }
                 $deleteFlag[$x] = true;
                 $deletedCount++;
             }
         }
         flush();
     }
     $this->output($this->bmhNewLine . 'Closing mailbox, and purging messages');
     imap_close($this->mailboxLink);
     $this->output('Read: ' . $fetchedCount . ' messages');
     $this->output($processedCount . ' action taken');
     $this->output($unprocessedCount . ' no action taken');
     $this->output($deletedCount . ' messages deleted');
     $this->output($movedCount . ' messages moved');
     return true;
 }
开发者ID:natxet,项目名称:PHPMailer-BMH,代码行数:101,代码来源:BounceMailHandler.php

示例9: removeEamil

 /**
  * 移动/移除 邮件
  * @param $mid
  */
 public function removeEamil($mid)
 {
     if (!$this->marubox) {
         return false;
     } else {
         imap_mail_move($this->marubox, $mid, 'INBOX');
     }
 }
开发者ID:lovecheng,项目名称:brs-demo2,代码行数:12,代码来源:Email.php

示例10: move

 /**
  * Move message to another mailbox
  *
  * @param integer $msgno Message number to move
  * @param string $mbox Mailbox to move message to
  * @return boolean
  */
 function move($msgno, $mbox)
 {
     // Only imap supports moving of mesages
     if ($server_type == "imap") {
         $list = imap_list($this->conn, $this->server, "*");
         if (!in_array($mbox, $list)) {
             if (!imap_createmailbox($this->conn, imap_utf7_encode($this->server . $mbox))) {
                 // $_ENV['api']['sys']->log("Creation of $mbox mailbox failed!","mailer");
             }
         }
         return imap_mail_move($this->conn, $msgno, $mbox);
     } else {
         return imap_delete($this->conn, $msgno);
     }
 }
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:22,代码来源:mail.class.php

示例11: move

 /**
  * Move message to another mailbox
  *
  * @param Mailbox $mailbox
  *
  * @throws MessageMoveException
  * @return Message
  */
 public function move(Mailbox $mailbox)
 {
     if (!imap_mail_move($this->stream, $this->messageNumber, $mailbox->getName(), \CP_UID)) {
         throw new MessageMoveException($this->messageNumber, $mailbox->getName());
     }
     return $this;
 }
开发者ID:shapecode,项目名称:imap,代码行数:15,代码来源:Message.php

示例12: deleteMails

 /**
  * Delete mail from that mail box
  *
  * @param $mid       String    mail Id
  * @param $folder    String   folder to move (delete if empty) (default '')
  *
  * @return Boolean
  **/
 function deleteMails($mid, $folder = '')
 {
     if (!empty($folder) && isset($this->fields[$folder]) && !empty($this->fields[$folder])) {
         $name = mb_convert_encoding($this->fields[$folder], "UTF7-IMAP", "UTF-8");
         if (imap_mail_move($this->marubox, $mid, $name)) {
             return true;
         }
         // raise an error and fallback to delete
         //TRANS: %1$s is the name of the folder, %2$s is the name of the receiver
         trigger_error(sprintf(__('Invalid configuration for %1$s folder in receiver %2$s'), $folder, $this->getName()));
     }
     return imap_delete($this->marubox, $mid);
 }
开发者ID:remicollet,项目名称:glpi,代码行数:21,代码来源:mailcollector.class.php

示例13: imap_fetchbody

            if ($overview[0]->from == "noreply@wcasd.net" && $overview[0]->seen == 0) {
                // 			if ( $overview[0]->from == "noreply@wcasd.net" ) {
                // 				$output.= "". $email_number ." - ";
                // 				$output.= "". $overview[0]->from .": ";
                // 				$output.= "". $overview[0]->subject.": ";
                // 				$output.= "". $overview[0]->seen ."\n";
                // 				$output.= "". $overview[0]->date ."\n";
                $message = imap_fetchbody($inbox, $email_number, 1);
                // 				echo $output;
                // 				echo $message;
                date_default_timezone_set("America/New_York");
                $date = date_create($overview[0]->date);
                $filename = date_format($date, 'dMY');
                //				$path = "$myhome/temp/Grades/";
                // 				$f = fopen("$myhome/file.txt", "w");
                $f = fopen($path . "" . $filename . "", "w");
                fwrite($f, "" . $message . "");
                fclose($f);
                // 				10Dec2013
                imap_mail_move($inbox, "{$email_number}", 'School');
                break;
            }
        }
    }
    /* close the connection */
    imap_close($inbox);
}
//else {
//	echo "$filename IS in $path\n";
//	exit(0);
//}
开发者ID:mpalermo73,项目名称:scripts-git,代码行数:31,代码来源:Grades_FetchLexGrades.php

示例14: MoveMessage

 /**
  * Called when the user moves an item on the PDA from one folder to another
  *
  * @param string              $folderid            id of the source folder
  * @param string              $id                  id of the message
  * @param string              $newfolderid         id of the destination folder
  * @param ContentParameters   $contentparameters
  *
  * @access public
  * @return boolean                      status of the operation
  * @throws StatusException              could throw specific SYNC_MOVEITEMSSTATUS_* exceptions
  */
 public function MoveMessage($folderid, $id, $newfolderid, $contentparameters)
 {
     ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s')", $folderid, $id, $newfolderid));
     $folderImapid = $this->getImapIdFromFolderId($folderid);
     $newfolderImapid = $this->getImapIdFromFolderId($newfolderid);
     if ($folderImapid == $newfolderImapid) {
         throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, destination folder is source folder. Canceling the move.", $folderid, $id, $newfolderid), SYNC_MOVEITEMSSTATUS_SAMESOURCEANDDEST);
     }
     $this->imap_reopen_folder($folderImapid);
     if ($this->imap_inside_cutoffdate(Utils::GetCutOffDate($contentparameters->GetFilterType()), $id)) {
         // read message flags
         $overview = @imap_fetch_overview($this->mbox, $id, FT_UID);
         if (!is_array($overview)) {
             throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, unable to retrieve overview of source message: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
         } else {
             // get next UID for destination folder
             // when moving a message we have to announce through ActiveSync the new messageID in the
             // destination folder. This is a "guessing" mechanism as IMAP does not inform that value.
             // when lots of simultaneous operations happen in the destination folder this could fail.
             // in the worst case the moved message is displayed twice on the mobile.
             $destStatus = imap_status($this->mbox, $this->server . $newfolderImapid, SA_ALL);
             if (!$destStatus) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, unable to open destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDDESTID);
             }
             $newid = $destStatus->uidnext;
             // move message
             $s1 = imap_mail_move($this->mbox, $id, $newfolderImapid, CP_UID);
             if (!$s1) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, copy to destination folder failed: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);
             }
             // delete message in from-folder
             $s2 = imap_expunge($this->mbox);
             // open new folder
             $stat = $this->imap_reopen_folder($newfolderImapid);
             if (!$stat) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, opening the destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);
             }
             // remove all flags
             $s3 = @imap_clearflag_full($this->mbox, $newid, "\\Seen \\Answered \\Flagged \\Deleted \\Draft", FT_UID);
             $newflags = "";
             $move_to_trash = strcasecmp($newfolderImapid, $this->create_name_folder(IMAP_FOLDER_TRASH)) == 0;
             if ($overview[0]->seen || $move_to_trash && defined('IMAP_AUTOSEEN_ON_DELETE') && IMAP_AUTOSEEN_ON_DELETE == true) {
                 $newflags .= "\\Seen";
             }
             if ($overview[0]->flagged) {
                 $newflags .= " \\Flagged";
             }
             if ($overview[0]->answered) {
                 $newflags .= " \\Answered";
             }
             $s4 = @imap_setflag_full($this->mbox, $newid, $newflags, FT_UID);
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): result s-move: '%s' s-expunge: '%s' unset-Flags: '%s' set-Flags: '%s'", $folderid, $id, $newfolderid, Utils::PrintAsString($s1), Utils::PrintAsString($s2), Utils::PrintAsString($s3), Utils::PrintAsString($s4)));
             // return the new id "as string"
             return $newid . "";
         }
     } else {
         throw new StatusException(sprintf("BackendIMAP->MoveMessage(): Message is outside the sync range"), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
     }
 }
开发者ID:peterbeck,项目名称:Z-Push-contrib,代码行数:71,代码来源:imap.php

示例15: imapMailMove

 /**
  * verschiebt die Nachricht mit der gegebenen uid in die gegebene Mailbox *auf dem selben Server*
  * @param integer $uid
  * @param string $dest_mbox
  * @return boolean
  */
 public function imapMailMove($uid, $dest_mbox)
 {
     if ($this->imap === null) {
         throw new IMAPException(__METHOD__ . ' not connected');
     }
     $this->imapPing(true);
     /*
      * dont't add the server part,
      * only the mailbox name works fine
      *
      * $dest_mbox = $this->server.$dest_mbox;
      */
     return imap_mail_move($this->imap, $uid, $dest_mbox, CP_UID);
 }
开发者ID:NEOatNHNG,项目名称:cacert-testmgr,代码行数:20,代码来源:imapConnection.php


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