本文整理汇总了PHP中imap_mail_copy函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_mail_copy函数的具体用法?PHP imap_mail_copy怎么用?PHP imap_mail_copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_mail_copy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyMail
/**
* Copys mails listed in mailId into new mailbox
* @return bool
*/
public function copyMail($mailId, $mailBox)
{
return imap_mail_copy($this->getImapStream(), $mailId, $mailBox, CP_UID) && $this->expungeDeletedMails();
}
示例2: moveEmails
/**
* moves emails from folder to folder
* @param string $fromIe I-E id
* @param string $fromFolder IMAP path to folder in which the email lives
* @param string $toIe I-E id
* @param string $toFolder
* @param string $uids UIDs of emails to move, either Sugar GUIDS or IMAP
* UIDs
* @param bool $copy Default false
* @return bool True on successful execution
*/
function moveEmails($fromIe, $fromFolder, $toIe, $toFolder, $uids, $copy = false)
{
global $app_strings;
global $current_user;
// same I-E server
if ($fromIe == $toIe) {
$GLOBALS['log']->debug("********* SUGARFOLDER - moveEmails() moving email from I-E to I-E");
//$exDestFolder = explode("::", $toFolder);
//preserve $this->mailbox
if (isset($this->mailbox)) {
$oldMailbox = $this->mailbox;
}
$this->retrieve($fromIe);
$this->mailbox = $fromFolder;
$this->connectMailserver();
$exUids = explode('::;::', $uids);
$uids = implode(",", $exUids);
// imap_mail_move accepts comma-delimited lists of UIDs
if ($copy) {
if (imap_mail_copy($this->conn, $uids, $toFolder, CP_UID)) {
$this->mailbox = $toFolder;
$this->connectMailserver();
$newOverviews = imap_fetch_overview($this->conn, $uids, FT_UID);
$this->updateOverviewCacheFile($newOverviews, 'append');
if (isset($oldMailbox)) {
$this->mailbox = $oldMailbox;
}
return true;
} else {
$GLOBALS['log']->debug("INBOUNDEMAIL: could not imap_mail_copy() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
}
} else {
if (imap_mail_move($this->conn, $uids, $toFolder, CP_UID)) {
$GLOBALS['log']->info("INBOUNDEMAIL: imap_mail_move() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
imap_expunge($this->conn);
// hard deletes moved messages
// update cache on fromFolder
$newOverviews = $this->getOverviewsFromCacheFile($uids, $fromFolder, true);
$this->deleteCachedMessages($uids, $fromFolder);
// update cache on toFolder
$this->checkEmailOneMailbox($toFolder, true, true);
if (isset($oldMailbox)) {
$this->mailbox = $oldMailbox;
}
return true;
} else {
$GLOBALS['log']->debug("INBOUNDEMAIL: could not imap_mail_move() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
}
}
} elseif ($toIe == 'folder' && $fromFolder == 'sugar::Emails') {
$GLOBALS['log']->debug("********* SUGARFOLDER - moveEmails() moving email from SugarFolder to SugarFolder");
// move from sugar folder to sugar folder
require_once "include/SugarFolders/SugarFolders.php";
$sugarFolder = new SugarFolder();
$exUids = explode($app_strings['LBL_EMAIL_DELIMITER'], $uids);
foreach ($exUids as $id) {
if ($copy) {
$sugarFolder->copyBean($fromIe, $toFolder, $id, "Emails");
} else {
$fromSugarFolder = new SugarFolder();
$fromSugarFolder->retrieve($fromIe);
$toSugarFolder = new SugarFolder();
$toSugarFolder->retrieve($toFolder);
$email = new Email();
$email->retrieve($id);
$email->status = 'unread';
// when you move from My Emails to Group Folder, Assign To field for the Email should become null
if ($fromSugarFolder->is_dynamic && $toSugarFolder->is_group) {
$email->assigned_user_id = "";
$email->save();
if (!$toSugarFolder->checkEmailExistForFolder($id)) {
$fromSugarFolder->deleteEmailFromAllFolder($id);
$toSugarFolder->addBean($email);
}
} elseif ($fromSugarFolder->is_group && $toSugarFolder->is_dynamic) {
$fromSugarFolder->deleteEmailFromAllFolder($id);
$email->assigned_user_id = $current_user->id;
$email->save();
} else {
// If you are moving something from personal folder then delete an entry from all folder
if (!$fromSugarFolder->is_dynamic && !$fromSugarFolder->is_group) {
$fromSugarFolder->deleteEmailFromAllFolder($id);
}
// if
if ($fromSugarFolder->is_dynamic && !$toSugarFolder->is_dynamic && !$toSugarFolder->is_group) {
$email->assigned_user_id = "";
$toSugarFolder->addBean($email);
}
// if
//.........这里部分代码省略.........
示例3: moveToMailBox
/**
* This function is used to move a mail to the given mailbox.
*
* @param $mailbox
*
* @return bool
*/
public function moveToMailBox($mailbox)
{
$currentBox = $this->imapConnection->getMailBox();
$this->imapConnection->setMailBox($this->mailbox);
$returnValue = imap_mail_copy($this->imapStream, $this->uid, $mailbox, CP_UID | CP_MOVE);
imap_expunge($this->imapStream);
$this->mailbox = $mailbox;
$this->imapConnection->setMailBox($currentBox);
return $returnValue;
}
示例4: imapMailCopy
/**
* kopiert 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 imapMailCopy($uid, $dest_mbox)
{
if ($this->imap === null) {
throw new IMAPException(__METHOD__ . ' not connected');
}
$this->imapPing(true);
return imap_mail_copy($this->imap, $uid, $dest_mbox, CP_UID);
}
示例5: imap_mail_copy
<?php
/* Prototype : bool imap_mail_copy ( resource $imap_stream , string $msglist , string $mailbox [, int $options = 0 ] )
* Description: Copies mail messages specified by msglist to specified mailbox.
* Source code: ext/imap/php_imap.c
*/
echo "*** Testing imap_mail_copy() : basic functionality ***\n";
require_once dirname(__FILE__) . '/imap_include.inc';
echo "Create a new mailbox for test\n";
$imap_stream = setup_test_mailbox("", 1);
if (!is_resource($imap_stream)) {
exit("TEST FAILED: Unable to create test mailbox\n");
}
$check = imap_check($imap_stream);
echo "Msg Count in new mailbox: " . $check->Nmsgs . "\n";
var_dump(imap_mail_copy($imap_stream, '1', 'INBOX.' . $mailbox_prefix));
imap_close($imap_stream);
?>
===Done===
<?php
require_once 'clean.inc';
示例6: xmlrpcmsg
}
/* output the email header information */
$subject = $overview[0]->subject;
$to = $header->to[0]->mailbox . '@' . $header->to[0]->host;
$from = $overview[0]->from;
$date = $overview[0]->date;
$msgid = $header->message_id;
$message = new xmlrpcmsg('support.request', array(new xmlrpcval($subject, 'string'), new xmlrpcval($from, 'string'), new xmlrpcval($body, 'struct'), new xmlrpcval($to, 'string')));
//$server->setdebug(1);
$result = $server->send($message);
// Process the response.
if (!$result) {
echo "Could not connect to HTTP server.\n";
} elseif ($result->faultCode()) {
echo "XML-RPC Fault #" . $result->faultCode() . ": " . $result->faultString() . "\n";
} else {
$struct = $result->value();
$result = $struct->structmem('result');
$response = $struct->structmem('response');
echo $result->scalarval() . ':' . $response->scalarval() . "\n";
if ($result->scalarval() == 'SUCCESS') {
imap_mail_copy($inbox, $email_number, 'processed');
imap_delete($inbox, $email_number);
}
}
}
imap_expunge($inbox);
}
/* close the connection */
imap_close($inbox);
// End of xmlrpc_mail_client
示例7: ExecuteAction
function ExecuteAction($rule, $aResults)
{
$this->output->say(" - Executing action: " . $rule['action'], 0);
if (!empty($rule['destination'])) {
$this->output->say("-->" . $rule['destination'] . ":");
} else {
$this->output->say(":");
}
foreach ($aResults as $key => $uid) {
$this->output->say(" - Message id " . $uid . "...", 0);
if ($rule['action'] == "MOVE") {
if ($this->CheckAndCreateMailbox($rule['destination'])) {
$success = imap_mail_move($this->conn, $uid, $rule['destination'], CP_UID);
}
} elseif ($rule['action'] == "COPY") {
if ($this->CheckAndCreateMailbox($rule['destination'])) {
$success = imap_mail_copy($this->conn, $uid, $rule['destination'], CP_UID);
}
} elseif ($rule['action'] == "DELETE") {
$success = imap_delete($this->conn, $uid, FT_UID);
}
if ($success) {
$this->output->say("OK");
} else {
$this->output->say("FAIL");
}
}
}
示例8: apliSieveFilter
/**
* Método que aplica a ação do filtro nas mensagens da caixa de entrada
*
* @license http://www.gnu.org/copyleft/gpl.html GPL
* @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
* @sponsor Caixa Econômica Federal
* @author Airton Bordin Junior <airton@prognus.com.br>
* @author Gustavo Pereira dos Santos <gustavo@prognus.com.br>
* @param <Array> <$msgs> <Mensagens da caixa de entrada>
* @param <Array> <$proc> <ações do filtro>
* @return <Regras do usuário em Array>
* @access public
*/
function apliSieveFilter($msgs, $proc)
{
$ret = array();
foreach ($msgs as $i => $msg) {
switch ($proc['type']) {
case 'fileinto':
$imap = $this->open_mbox('INBOX');
if ($proc['keep'] === true) {
$ret[$msg][] = imap_mail_copy($imap, $msg, $proc['value'], CP_UID);
} else {
/* Está sempre copiando a mensagem para a pasta destino */
//$ret[$msg][] = imap_mail_move($imap,$msg,$proc['parameter'], CP_UID);
$ret[$msg][] = imap_mail_move($imap, $msg, $proc['parameter'], CP_UID);
imap_expunge($imap);
}
break;
case 'redirect':
foreach ($msgs as $msg) {
$info = $this->get_info_msg(array('msg_folder' => 'INBOX', 'msg_number' => $msg));
Controller::create(array('service' => 'SMTP'), array('body' => $info['body'], 'isHtml' => true, 'subject' => $info['subject'], 'from' => $info['from']['full'], 'to' => $proc['parameter']));
if ($proc['keep'] !== true) {
$this->delete_msgs(array('msgs_number' => $msg, 'folder' => 'INBOX'));
}
}
break;
case 'setflag':
foreach ($msgs as $msg) {
$ret[$msg][] = $this->set_messages_flag(array('folder' => 'INBOX', 'msgs_to_set' => $msg, 'flag' => $proc['parameter']));
}
break;
}
}
return $ret;
}
示例9: imap_mail_copy
<?php
echo "Checking with no parameters\n";
imap_mail_copy();
echo "Checking with incorrect parameter type\n";
imap_mail_copy('');
imap_mail_copy(false);
// more tests
require_once dirname(__FILE__) . '/imap_include.inc';
echo "Test with IMAP server\n";
$stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox {$default_mailbox}: " . imap_last_error());
var_dump(imap_mail_copy($stream_id));
var_dump(imap_mail_copy($stream_id, -1));
var_dump(imap_mail_copy($stream_id, ''));
imap_close($stream_id);
?>
===Done===
示例10: copymail
/**
* Copy a mail message to another folder
*
* @param int $num
* @param string $newfolder
* @return
* @access public
*/
function copymail($num, $newfolder)
{
if ($this->protocol == 'POP3') {
//POP3 does not support folders so just return false
$this->errors[] = GM_NO_POP3_SUPPORT;
return false;
}
//if (strtoupper($newfolder) != 'INBOX')
// $folder = "INBOX.$newfolder";
if ($this->use_native) {
$status = imap_mail_copy($this->mailer, $num, $newfolder);
if (!$status) {
$this->errors[] = imap_last_error();
return false;
}
return true;
} else {
$status = $this->mailer->copyMessages($num, $newfolder);
if ($status !== true) {
$this->errors[] = $status->getMessage();
return false;
}
return true;
}
}
示例11: mailcopy
function mailcopy($stream, $msg_list, $mailbox, $flags = 0)
{
// do we force use of msg UID's
if ($this->force_msg_uids == True && !($flags & CP_UID)) {
$flags |= CP_UID;
}
$mailbox = $this->utf7_encode($mailbox);
return imap_mail_copy($stream, $msg_list, $mailbox, $flags);
}
示例12: copyMail
/**
* Copies mail to another mailbox
* @param int $mailId
* @param string $toMailbox
* @throws DriverException
*/
public function copyMail($mailId, $toMailbox)
{
if (!imap_mail_copy($this->resource, $mailId, $this->server . $this->encodeMailboxName($toMailbox), CP_UID)) {
throw new DriverException("Cannot copy mail to mailbox '{$toMailbox}': " . imap_last_error());
}
}
示例13: mail_copy
public function mail_copy($sequence, $dest)
{
return imap_mail_copy($this->imapStream, $sequence, $dest, CP_UID);
}
示例14: mailCopy
/**
* Copy specified messages to a mailbox.
*
* @link http://php.net/manual/en/function.imap-mail-copy.php
*
* @param resource $stream
* @param string $msglist <p>
* <i>msglist</i> is a range not just message
* numbers (as described in RFC2060).
* </p>
* @param string $mailbox <p>
* The mailbox name, see <b>imap_open</b> for more
* information
* </p>
* @param int $options [optional] <p>
* <i>options</i> is a bitmask of one or more of
* <b>CP_UID</b> - the sequence numbers contain UIDS
*
* @throws \RuntimeException If operation fail
*/
public function mailCopy($stream, $msglist, $mailbox, $options = 0)
{
$result = imap_mail_copy($stream, $msglist, $mailbox, $options);
if (empty($result)) {
throw new \RuntimeException(imap_last_error());
}
}
示例15: copyMail
/**
* Copy specified messages to a mailbox.
*
* @param int $uniqueId
* @param string $mailBoxName
* @return bool
*/
public function copyMail($uniqueId, $mailBoxName)
{
return imap_mail_copy($this->ressource, $uniqueId, $mailBoxName, FT_UID);
}