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


PHP imap_utf7_encode函数代码示例

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


在下文中一共展示了imap_utf7_encode函数的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: getMailbox

 /**
  * Get a mailbox by its name
  *
  * @param string $name Mailbox name
  *
  * @return Mailbox
  * @throws Mirasvit_Ddeboer_Imap_Exception_MailboxDoesNotExistException If mailbox does not exist
  */
 public function getMailbox($name)
 {
     if (!in_array($name, $this->getMailboxNames())) {
         throw new Mirasvit_Ddeboer_Imap_Exception_MailboxDoesNotExistException($name);
     }
     return new Mirasvit_Ddeboer_Imap_Mailbox($this->server . imap_utf7_encode($name), $this);
 }
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:15,代码来源:Connection.php

示例3: getMailbox

 /**
  * Get a mailbox by its name
  *
  * @param string $name Mailbox name
  *
  * @return Mailbox
  * @throws MailboxDoesNotExistException If mailbox does not exist
  */
 public function getMailbox($name)
 {
     if (!\in_array($name, $this->getMailboxNames())) {
         throw new MailboxDoesNotExistException($name);
     }
     return new Mailbox($this->server . \imap_utf7_encode($name), $this);
 }
开发者ID:jhonn921007,项目名称:imap,代码行数:15,代码来源:Connection.php

示例4: getMailbox

 /**
  * Get a mailbox by its name
  *
  * @param string $name Mailbox name
  *
  * @return Mailbox
  * @throws MailboxDoesNotExistException If mailbox does not exist
  */
 public function getMailbox($name)
 {
     if (!$this->hasMailbox($name)) {
         throw new MailboxDoesNotExistException($name);
     }
     return new Mailbox($this->server . imap_utf7_encode($name), $this);
 }
开发者ID:Kofel,项目名称:imap,代码行数:15,代码来源:Connection.php

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

示例6: encodeFolderName

 function encodeFolderName($_folderName)
 {
     if ($this->mbAvailable) {
         return mb_convert_encoding($_folderName, "UTF7-IMAP", "ISO_8859-1");
     }
     // if not
     return imap_utf7_encode($_folderName);
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:8,代码来源:class.defaultpop.inc.php

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

示例8: encodeFolderName

 function encodeFolderName($_folderName)
 {
     if ($this->mbAvailable) {
         return mb_convert_encoding($_folderName, "UTF7-IMAP", $GLOBALS['phpgw']->translation->charset());
     }
     // if not
     // can only encode from ISO 8559-1
     return imap_utf7_encode($_folderName);
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:9,代码来源:class.defaultimap.inc.php

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

示例10: RIMAP_check

/**
* Check the username / password against the IMAP server
*/
function RIMAP_check($username, $password)
{
    global $c;
    $imap_username = $username;
    if (function_exists('mb_convert_encoding')) {
        $imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP", mb_detect_encoding($imap_username));
    } else {
        $imap_username = imap_utf7_encode($imap_username);
    }
    //$imap_url = '{localhost:143/imap/notls}';
    //$imap_url = '{localhost:993/imap/ssl/novalidate-cert}';
    $imap_url = $c->authenticate_hook['config']['imap_url'];
    $auth_result = "ERR";
    $imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN);
    //print_r(imap_errors());
    if ($imap_stream) {
        // disconnect
        imap_close($imap_stream);
        // login ok
        $auth_result = "OK";
    }
    if ($auth_result == "OK") {
        $principal = new Principal('username', $username);
        if (!$principal->Exists()) {
            dbg_error_log("PAM", "Principal '%s' doesn't exist in local DB, we need to create it", $username);
            if (strstr($username, '@')) {
                $name_arr = explode('@', $username);
                $fullname = ucfirst(strtolower($name_arr[0]));
                $email = $username;
            } else {
                $fullname = ucfirst(strtolower($username));
                $email = $username . "@" . $c->authenticate_hook['config']['email_base'];
            }
            $principal->Create(array('username' => $username, 'user_active' => true, 'email' => $email, 'fullname' => ucfirst($fullname)));
            if (!$principal->Exists()) {
                dbg_error_log("PAM", "Unable to create local principal for '%s'", $username);
                return false;
            }
            CreateHomeCollections($username);
        }
        return $principal;
    } else {
        dbg_error_log("PAM", "User %s is not a valid username (or password was wrong)", $username);
        return false;
    }
}
开发者ID:derekyu1437,项目名称:davical,代码行数:49,代码来源:drivers_rimap.php

示例11: read

 private function read()
 {
     $allMails = imap_search($this->conn, 'ALL');
     if ($allMails) {
         rsort($allMails);
         foreach ($allMails as $email_number) {
             $overview = imap_fetch_overview($this->conn, $email_number, 0);
             $structure = imap_fetchstructure($this->conn, $email_number);
             $body = '';
             if (isset($structure->parts) && is_array($structure->parts) && isset($structure->parts[1])) {
                 $part = $structure->parts[1];
                 $body = imap_fetchbody($this->conn, $email_number, 2);
                 if ($part->encoding == 3) {
                     $body = imap_base64($body);
                 } else {
                     if ($part->encoding == 1) {
                         $body = imap_8bit($body);
                     } else {
                         $body = imap_qprint($body);
                     }
                 }
             }
             $body = utf8_decode($body);
             $fromaddress = utf8_decode(imap_utf7_encode($overview[0]->from));
             $subject = mb_decode_mimeheader($overview[0]->subject);
             $date = utf8_decode(imap_utf8($overview[0]->date));
             $date = date('Y-m-d H:i:s', strtotime($date));
             $key = md5($fromaddress . $subject . $body);
             //save to MySQL
             $sql = "SELECT count(*) FROM EMAIL_INFORMATION WHERE IDMAIL = " . $this->id . " AND CHECKVERS = \"" . $key . "\"";
             $resul = $this->pdo->query($sql)->fetch();
             if ($resul[0] == 0) {
                 $this->pdo->prepare("INSERT INTO EMAIL_INFORMATION (IDMAIL,FROMADDRESS,SUBJECT,DATE,BODY,CHECKVERS) VALUES (?,?,?,?,?,?)");
                 $this->pdo->execute(array($this->id, $fromaddress, $subject, $date, $body, $key));
             }
         }
     }
 }
开发者ID:GPierre-Antoine,项目名称:projetphp,代码行数:38,代码来源:Email.php

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

示例13: mailbox_encode

 function mailbox_encode($mailbox)
 {
     if (!$mailbox) {
         return null;
     } elseif (function_exists('mb_convert_encoding')) {
         return mb_convert_encoding($mailbox, 'UTF7-IMAP', 'utf-8');
     } else {
         // XXX: This function has some issues on some versions of PHP
         return imap_utf7_encode($mailbox);
     }
 }
开发者ID:KM-MFG,项目名称:osTicket-1.8,代码行数:11,代码来源:class.mailfetch.php

示例14: utf7_encode_string

 function utf7_encode_string($data_str)
 {
     $name = array();
     $name['folder_before'] = '';
     $name['folder_after'] = '';
     $name['translated'] = '';
     if (strstr($data_str, '}')) {
         // folder name at this stage is  {SERVER_NAME:PORT}FOLDERNAME
         // get everything to the right of the bracket "}", INCLUDES the bracket itself
         $name['folder_before'] = strstr($data_str, '}');
         // get rid of that 'needle' "}"
         $name['folder_before'] = substr($name['folder_before'], 1);
         // translate
         if (function_exists('recode_string') == False) {
             $name['folder_after'] = imap_utf7_encode($name['folder_before']);
         } else {
             // Modif UTF-8 by Sam Przyswa so now compatible with MS-Outlook and Netscape accentued folder name
             $name_tmp = recode_string("ISO-8859-1..UTF-7", $name['folder_before']);
             $name['folder_after'] = str_replace("+", "&", $name_tmp);
         }
         // replace old folder name with new folder name
         $name['translated'] = str_replace($name['folder_before'], $name['folder_after'], $data_str);
     } else {
         // folder name at this stage is  FOLDERNAME
         // there is NO {SERVER} part in this name, this is OK some commands do not require it (mail_move same acct)
         $name['folder_before'] = $data_str;
         // translate
         $name['folder_after'] = imap_utf7_encode($name['folder_before']);
         $name['translated'] = $name['folder_after'];
     }
     if ($this->debug_utf7 > 1) {
         echo ' _ mail_dcom_base: utf7_encode_string (' . __LINE__ . '): $name DUMP: [' . htmlspecialchars(serialize($name)) . ']<br>';
     }
     return $name['translated'];
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:35,代码来源:class.mail_dcom_base.inc.php

示例15: createMailbox

 function createMailbox($folder)
 {
     if (!$folder) {
         return false;
     }
     return imap_createmailbox($this->mbox, imap_utf7_encode($this->srvstr . trim($folder)));
 }
开发者ID:nunomartins,项目名称:osTicket-1.7,代码行数:7,代码来源:class.mailfetch.php


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