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


PHP imap_createmailbox函数代码示例

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


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

示例1: getdata

 function getdata($host, $login, $password, $savedirpath)
 {
     $mbox = imap_open($host, $login, $password) or die("can't connect: " . imap_last_error());
     $message = array();
     $message["attachment"]["type"][0] = "text";
     $message["attachment"]["type"][1] = "multipart";
     $message["attachment"]["type"][2] = "message";
     $message["attachment"]["type"][3] = "application";
     $message["attachment"]["type"][4] = "audio";
     $message["attachment"]["type"][5] = "image";
     $message["attachment"]["type"][6] = "video";
     $message["attachment"]["type"][7] = "other";
     $buzon_destino = "cfdi";
     echo imap_createmailbox($mbox, imap_utf7_encode("{$buzon_destino}"));
     echo imap_num_msg($mbox);
     for ($jk = 1; $jk <= imap_num_msg($mbox); $jk++) {
         $structure = imap_fetchstructure($mbox, $jk);
         $parts = $structure->parts;
         $fpos = 2;
         for ($i = 1; $i < count($parts); $i++) {
             $message["pid"][$i] = $i;
             $part = $parts[$i];
             if (strtolower($part->disposition) == "attachment") {
                 $message["type"][$i] = $message["attachment"]["type"][$part->type] . "/" . strtolower($part->subtype);
                 $message["subtype"][$i] = strtolower($part->subtype);
                 $ext = $part->subtype;
                 $params = $part->dparameters;
                 $filename = $part->dparameters[0]->value;
                 if (!($ext == 'xml' or $ext == 'XML' or $ext == 'PDF' or $ext == 'pdf')) {
                     continue;
                 }
                 $mege = "";
                 $data = "";
                 $mege = imap_fetchbody($mbox, $jk, $fpos);
                 $data = $this->getdecodevalue($mege, $part->type);
                 $fp = fopen($filename, 'w');
                 fputs($fp, $data);
                 fclose($fp);
                 $fpos += 1;
                 /* Se mueve el archiv descargado al directorio de recibidos */
                 //                    rename($filename, $savedirpath.$filename);
                 //                    printf("\nSe movio el archivo $filename");
             }
         }
         $result = imap_fetch_overview($mbox, $jk);
         echo $result[0]->from;
         //            imap_mail_move($mbox, $jk, $buzon_destino);
         //imap_delete tags a message for deletion
         //    imap_delete($mbox,$jk);
     }
     // imap_expunge deletes all tagged messages
     //                    imap_expunge($mbox);
     imap_close($mbox);
 }
开发者ID:njmube,项目名称:CSDOCSCFDI,代码行数:54,代码来源:CorreoGetAdjuntos.class.php

示例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'));
 }
开发者ID:gAb09,项目名称:NetP,代码行数:18,代码来源:ImapController.php

示例3: store_email_into_folder

function store_email_into_folder($msg, $folder = 'SentFromDolibarr')
{
    global $user, $db;
    $mailboxconfig = new Usermailboxconfig($db);
    $mailboxconfig->fetch_from_user($user->id);
    $user->mailbox_imap_login = $mailboxconfig->mailbox_imap_login;
    $user->mailbox_imap_password = $mailboxconfig->mailbox_imap_password;
    $user->mailbox_imap_host = $mailboxconfig->mailbox_imap_host;
    $user->mailbox_imap_port = $mailboxconfig->mailbox_imap_port;
    $user->mailbox_imap_ssl = $mailboxconfig->mailbox_imap_ssl;
    $user->mailbox_imap_ssl_novalidate_cert = $mailboxconfig->mailbox_imap_ssl_novalidate_cert;
    $user->mailbox_imap_ref = $mailboxconfig->get_ref();
    $user->mailbox_imap_connector_url = $mailboxconfig->get_connector_url();
    $mbox = imap_open($user->mailbox_imap_connector_url . $folder, $user->mailbox_imap_login, $user->mailbox_imap_password);
    $check = imap_check($mbox);
    $before = $check->Nmsgs;
    $result = imap_append($mbox, $user->mailbox_imap_connector_url . $folder, $msg);
    $check = imap_check($mbox);
    $after = $check->Nmsgs;
    if ($result == FALSE) {
        if (imap_createmailbox($mbox, imap_utf7_encode($user->mailbox_imap_ref . $folder))) {
            $mbox = imap_open($user->mailbox_imap_connector_url . $folder, $user->mailbox_imap_login, $user->mailbox_imap_password);
            $check = imap_check($mbox);
            $before = $check->Nmsgs;
            $result = imap_append($mbox, $user->mailbox_imap_connector_url . $folder, $msg);
            $check = imap_check($mbox);
            $after = $check->Nmsgs;
        }
    }
    imap_close($mbox);
}
开发者ID:zenp76,项目名称:dolibarr-webmail-module,代码行数:31,代码来源:lib_dolimail.php

示例4: download_and_process_email_replies

 /**
  * Primary method for downloading and processing email replies
  */
 public function download_and_process_email_replies($connection_details)
 {
     imap_timeout(IMAP_OPENTIMEOUT, apply_filters('supportflow_imap_open_timeout', 5));
     $ssl = $connection_details['imap_ssl'] ? '/ssl' : '';
     $ssl = apply_filters('supportflow_imap_ssl', $ssl, $connection_details['imap_host']);
     $mailbox = "{{$connection_details['imap_host']}:{$connection_details['imap_port']}{$ssl}}";
     $inbox = "{$mailbox}{$connection_details['inbox']}";
     $archive_box = "{$mailbox}{$connection_details['archive']}";
     $imap_connection = imap_open($mailbox, $connection_details['username'], $connection_details['password']);
     $redacted_connection_details = $connection_details;
     $redacted_connection_details['password'] = '[redacted]';
     // redact the password to avoid unnecessarily exposing it in logs
     $imap_errors = imap_errors();
     SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, $imap_connection ? __('Successfully opened IMAP connection.', 'supportflow') : __('Failed to open IMAP connection.', 'supportflow'), compact('redacted_connection_details', 'mailbox', 'imap_errors'));
     if (!$imap_connection) {
         return new WP_Error('connection-error', __('Error connecting to mailbox', 'supportflow'));
     }
     // Check to see if the archive mailbox exists, and create it if it doesn't
     $mailboxes = imap_getmailboxes($imap_connection, $mailbox, '*');
     if (!wp_filter_object_list($mailboxes, array('name' => $archive_box))) {
         imap_createmailbox($imap_connection, $archive_box);
     }
     // Make sure here are new emails to process
     $email_count = imap_num_msg($imap_connection);
     if ($email_count < 1) {
         SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, __('No new messages to process.', 'supportflow'), compact('mailboxes'));
         return false;
     }
     $emails = imap_search($imap_connection, 'ALL', SE_UID);
     $email_count = min($email_count, apply_filters('supportflow_max_email_process_count', 20));
     $emails = array_slice($emails, 0, $email_count);
     $processed = 0;
     // Process each new email and put it in the archive mailbox when done.
     foreach ($emails as $uid) {
         $email = new stdClass();
         $email->uid = $uid;
         $email->msgno = imap_msgno($imap_connection, $email->uid);
         $email->headers = imap_headerinfo($imap_connection, $email->msgno);
         $email->structure = imap_fetchstructure($imap_connection, $email->msgno);
         $email->body = $this->get_body_from_connection($imap_connection, $email->msgno);
         if (0 === strcasecmp($connection_details['username'], $email->headers->from[0]->mailbox . '@' . $email->headers->from[0]->host)) {
             $connection_details['password'] = '[redacted]';
             // redact the password to avoid unnecessarily exposing it in logs
             SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, __('Skipping message because it was sent from a SupportFlow account.', 'supportflow'), compact('email'));
             continue;
         }
         // @todo Confirm this a message we want to process
         $result = $this->process_email($imap_connection, $email, $email->msgno, $connection_details['username'], $connection_details['account_id']);
         // If it was successful, move the email to the archive
         if ($result) {
             imap_mail_move($imap_connection, $email->uid, $connection_details['archive'], CP_UID);
             $processed++;
         }
     }
     imap_close($imap_connection, CL_EXPUNGE);
     $status_message = sprintf(__('Processed %d emails', 'supportflow'), $processed);
     SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, $status_message);
     return $status_message;
 }
开发者ID:nagyistoce,项目名称:supportflow,代码行数:62,代码来源:class-supportflow-email-replies.php

示例5: createMailbox

 /**
  * Create mailbox
  *
  * @param $name
  *
  * @return Mailbox
  * @throws Exception
  */
 public function createMailbox($name)
 {
     if (\imap_createmailbox($this->resource, $this->server . $name)) {
         $this->mailboxNames = $this->mailboxes = null;
         return $this->getMailbox($name);
     }
     throw new Exception("Can not create '{$name}' mailbox at '{$this->server}'");
 }
开发者ID:jhonn921007,项目名称:imap,代码行数:16,代码来源:Connection.php

示例6: createMailbox

 /**
  * Create mailbox
  *
  * @param $name
  *
  * @return Mailbox
  * @throws Exception
  */
 public function createMailbox($name)
 {
     // Add support for International characters
     if (\imap_createmailbox($this->resource, \imap_utf7_encode($this->server . $name))) {
         $this->mailboxNames = $this->mailboxes = null;
         return $this->getMailbox($name);
     }
     throw new Exception("Can not create '{$name}' mailbox at '{$this->server}'");
 }
开发者ID:ctalbot,项目名称:imap,代码行数:17,代码来源:Connection.php

示例7: createFolder

 public function createFolder($name = NULL)
 {
     $nameArr = explode(".", $name);
     $folders = $this->getFoldersList();
     $createName = NULL;
     foreach ($nameArr as $v) {
         $createName .= !is_null($createName) ? "." : $this->getMailbox();
         $createName .= $v;
         if (!in_array($createName, $folders)) {
             imap_createmailbox($this->imapStream, imap_utf7_encode($createName));
         }
     }
 }
开发者ID:trejjam,项目名称:emailing,代码行数:13,代码来源:Imap.php

示例8: createmailbox

function createmailbox($mbox, $server, $mailbox)
{
    global $src_username;
    $mailbox = mb_convert_encoding($mailbox, "UTF7-IMAP", "ISO_8859-1");
    if (@imap_createmailbox($mbox, "{" . $server . "}{$mailbox}")) {
        $status = @imap_status($mbox, "{" . $server . "}" . $mailbox, SA_ALL);
        if ($status) {
            print "{$src_username} - {$mailbox}:\n";
            print "UIDvalidity:" . $status->uidvalidity . "\n\n";
            imap_subscribe($mbox, "{" . $server . "}{$mailbox}");
        } else {
            print "imap_status on new mailbox - {$mailbox} failed: " . imap_last_error() . "\n";
        }
    } else {
        print "could not create new mailbox - {$mailbox}: " . implode("\n", imap_errors()) . "\n";
    }
}
开发者ID:Jensen-Technologies,项目名称:imap-importing,代码行数:17,代码来源:archive.php

示例9: manageMB

 /**
  * This method creates, renames and deletes mailboxes from the server.
  *
  * @param    string $action
  *   One of create|rename|delete, this tells the method what you want to
  *    do with a mailbox.
  * @param    string $mb_name
  *   The name of the mailbox to create, delete or rename.
  * @param    string $mb_rename
  *   (optional) New name for the mailbox, if it is being renamed.
  *
  * @return   BOOL
  * @access   public
  * @see      imap_createmailbox
  * @see      imap_renamemailbox
  * @see      imap_deletemailbox
  * @tutorial http://www.smilingsouls.net/Mail_IMAP?content=Mail_IMAP_ManageMB/manageMB
  */
 function manageMB($action, $mb_name, $mb_rename = NULL)
 {
     switch ($action) {
         case 'create':
             if (@imap_createmailbox($this->mailbox, imap_utf7_encode($this->mailboxInfo['host'] . 'INBOX.' . $mb_name))) {
                 $ret = TRUE;
             } else {
                 $this->error->push(Mail_IMAPv2_ERROR, 'error', NULL, 'Unable to create MB: ' . $mb_name);
                 $ret = FALSE;
             }
             break;
         case 'rename':
             if (empty($mb_rename)) {
                 $this->error->push(Mail_IMAPv2_ERROR, 'error', NULL, 'No mailbox provided to rename.');
             }
             if (@imap_renamemailbox($this->mailbox, $this->mailboxInfo['host'] . 'INBOX.' . $mb_name, $this->mailboxInfo['host'] . 'INBOX.' . $mb_rename)) {
                 $ret = TRUE;
             } else {
                 $this->error->push(Mail_IMAPv2_ERROR, 'error', NULL, 'Unable to rename MB: ' . $mb_name);
                 $ret = FALSE;
             }
             break;
         case 'delete':
             if (@imap_deletemailbox($this->mailbox, $this->mailboxInfo['host'] . 'INBOX.' . $mb_name)) {
                 $ret = TRUE;
             } else {
                 $this->error->push(Mail_IMAPv2_ERROR, 'error', NULL, 'Unable to delete MB: ' . $mb_name);
                 $ret = FALSE;
             }
             break;
         default:
             $this->error->push(Mail_IMAPv2_ERROR_INVALID_ACTION, 'error', array('action' => $action, 'arg' => '$action'));
             $ret = FALSE;
             return $ret;
     }
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:54,代码来源:ManageMB.php

示例10: ChangeFolder

 function ChangeFolder($folderid, $oldid, $displayname, $type)
 {
     debugLog("ChangeFolder: (parent: '{$folderid}'  oldid: '{$oldid}'  displayname: '{$displayname}'  type: '{$type}')");
     // go to parent mailbox
     $this->imap_reopenFolder($folderid);
     // build name for new mailbox
     $newname = $this->_server . str_replace(".", $this->_serverdelimiter, $folderid) . $this->_serverdelimiter . $displayname;
     $csts = false;
     // if $id is set => rename mailbox, otherwise create
     if ($oldid) {
         // rename doesn't work properly with IMAP
         // the activesync client doesn't support a 'changing ID'
         //$csts = imap_renamemailbox($this->_mbox, $this->_server . imap_utf7_encode(str_replace(".", $this->_serverdelimiter, $oldid)), $newname);
     } else {
         $csts = @imap_createmailbox($this->_mbox, $newname);
     }
     if ($csts) {
         return $this->StatFolder($folderid . "." . $displayname);
     } else {
         return false;
     }
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:22,代码来源:imap.php

示例11: mailboxExist

 /**
  * Function to check if a mailbox exists
  * - if not found, it will create it
  *
  * @param string  $mailbox the mailbox name, must be in 'INBOX.checkmailbox' format
  * @param boolean $create  whether or not to create the checkmailbox if not found, defaults to true
  *
  * @return boolean
  */
 public function mailboxExist($mailbox, $create = true)
 {
     if (trim($mailbox) == '' || !strstr($mailbox, ' INBOX.')) {
         // this is a critical error with either the mailbox name blank or an invalid mailbox name
         // need to stop processing and exit at this point
         echo "Invalid mailbox name for move operation. Cannot continue.<br />\n";
         echo "TIP: the mailbox you want to move the message to must include 'INBOX.' at the start.<br />\n";
         exit;
     }
     $port = $this->port . '/' . $this->service . '/' . $this->serviceOption;
     $mbox = imap_open('{' . $this->mailhost . ":" . $port . '}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN);
     $list = imap_getmailboxes($mbox, '{' . $this->mailhost . ":" . $port . '}', "*");
     $mailboxFound = false;
     if (is_array($list)) {
         foreach ($list as $key => $val) {
             // get the mailbox name only
             $nameArr = split('}', imap_utf7_decode($val->name));
             $nameRaw = $nameArr[count($nameArr) - 1];
             if ($mailbox == $nameRaw) {
                 $mailboxFound = true;
             }
         }
         if ($mailboxFound === false && $create) {
             @imap_createmailbox($mbox, imap_utf7_encode('{' . $this->mailhost . ":" . $port . '}' . $mailbox));
             imap_close($mbox);
             return true;
         } else {
             imap_close($mbox);
             return false;
         }
     } else {
         imap_close($mbox);
         return false;
     }
 }
开发者ID:natxet,项目名称:PHPMailer-BMH,代码行数:44,代码来源:BounceMailHandler.php

示例12: moveMsg

 /**
  * Moves a msg to a different folder
  *
  * @param <int> $msgId id number of the msg in current mailbox
  * @param <string> $new_folder new folder's name
  * @param <bool> $create create folder if doesn't exist ?
  * @return <bool> true/false according to success
  */
 public function moveMsg($msgId, $new_folder, $create = true)
 {
     if (!$this->connectIfNeeded()) {
         return false;
     }
     if ($create) {
         @imap_createmailbox($this->connection, imap_utf7_encode('{' . $this->hostname . '}' . $new_folder));
     }
     $success = @imap_mail_move($this->connection, $msgId, $new_folder, CP_UID);
     @imap_expunge($this->connection);
     return $success;
 }
开发者ID:DBezemer,项目名称:server,代码行数:20,代码来源:KMailChecker.class.php

示例13: createMailbox

 /**
  * Create mailbox
  *
  * @param $name
  *
  * @return Mailbox
  * @throws Exception
  */
 public function createMailbox($name)
 {
     if ($this->closed) {
         return true;
     }
     //name must be encoded in utf7
     if (imap_createmailbox($this->resource, $this->server . $name)) {
         $this->mailboxNames = $this->mailboxes = null;
         return $this->getMailbox($name);
     }
     throw new Exception("Can not create '{$name}' mailbox at '{$this->server}'");
 }
开发者ID:gbcogivea,项目名称:imap,代码行数:20,代码来源:Connection.php

示例14: imap_lsub

<?php

echo "Checking with no parameters\n";
imap_lsub();
echo "Checking with incorrect parameter type\n";
imap_lsub('');
imap_lsub(false);
require_once dirname(__FILE__) . '/imap_include.inc';
$stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox {$default_mailbox}: " . imap_last_error());
imap_lsub($stream_id);
imap_lsub($stream_id, $default_mailbox);
var_dump(imap_lsub($stream_id, $default_mailbox, 'ezDvfXvbvcxSerz'));
echo "Checking OK\n";
$newbox = $default_mailbox . "." . $mailbox_prefix;
imap_createmailbox($stream_id, $newbox);
imap_subscribe($stream_id, $newbox);
$z = imap_lsub($stream_id, $default_mailbox, '*');
var_dump(is_array($z));
var_dump($z[0]);
imap_close($stream_id);
require_once 'clean.inc';
开发者ID:badlamer,项目名称:hhvm,代码行数:21,代码来源:imap_lsub_basic.php

示例15: updateAccount

 function updateAccount($_hookValues)
 {
     #_debug_array($_hookValues);
     $username = $_hookValues['account_lid'];
     if (isset($_hookValues['new_passwd'])) {
         $userPassword = $_hookValues['new_passwd'];
     }
     #_debug_array($this->profileData);
     $imapAdminUsername = $this->profileData['imapAdminUsername'];
     $imapAdminPW = $this->profileData['imapAdminPW'];
     $folderNames = array("user.{$username}", "user.{$username}.Trash", "user.{$username}.Sent");
     // create the mailbox
     if ($mbox = @imap_open($this->getMailboxString(), $imapAdminUsername, $imapAdminPW)) {
         // create the users folders
         foreach ($folderNames as $mailBoxName) {
             if (imap_createmailbox($mbox, imap_utf7_encode("{" . $this->profileData['imapServer'] . "}{$mailBoxName}"))) {
                 if (!imap_setacl($mbox, $mailBoxName, $username, "lrswipcd")) {
                     # log error message
                 }
             }
         }
         imap_close($mbox);
     } else {
         return false;
     }
     // we can only subscribe to the folders, if we have the users password
     if (isset($_hookValues['new_passwd'])) {
         if ($mbox = @imap_open($this->getMailboxString(), $username, $userPassword)) {
             imap_subscribe($mbox, $this->getMailboxString('INBOX'));
             imap_subscribe($mbox, $this->getMailboxString('INBOX.Sent'));
             imap_subscribe($mbox, $this->getMailboxString('INBOX.Trash'));
             imap_close($mbox);
         } else {
             # log error message
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:37,代码来源:class.cyrusimap.inc.php


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