• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imap_utf7_encode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了imap_utf7_encode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


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


示例17: GetFolderList

 function GetFolderList()
 {
     $folders = array();
     $list = @imap_getmailboxes($this->_mbox, $this->_server, "*");
     if (is_array($list)) {
         // reverse list to obtain folders in right order
         $list = array_reverse($list);
         foreach ($list as $val) {
             $box = array();
             // cut off serverstring
             $box["id"] = imap_utf7_decode(substr($val->name, strlen($this->_server)));
             // always use "." as folder delimiter
             $box["id"] = imap_utf7_encode(str_replace($val->delimiter, ".", $box["id"]));
             // explode hierarchies
             $fhir = explode(".", $box["id"]);
             if (count($fhir) > 1) {
                 $box["mod"] = imap_utf7_encode(array_pop($fhir));
                 // mod is last part of path
                 $box["parent"] = imap_utf7_encode(implode(".", $fhir));
                 // parent is all previous parts of path
             } else {
                 $box["mod"] = imap_utf7_encode($box["id"]);
                 $box["parent"] = "0";
             }
             $folders[] = $box;
         }
     } else {
         debugLog("GetFolderList: imap_list failed: " . imap_last_error());
     }
     return $folders;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:31,代码来源:imap.php


示例18: define

}
define('CID', false);
define('READ_ONLY_SESSION', true);
require_once '../../../include.php';
ModuleManager::load_modules();
if (!Acl::is_user()) {
    die('not logged');
}
@set_time_limit(0);
$rec = Utils_RecordBrowserCommon::get_record('rc_accounts', $_POST['acc_id']);
if ($rec['epesi_user'] !== Acl::get_user()) {
    die('invalid account id');
}
$port = $rec['security'] == 'ssl' ? 993 : 143;
$server_str = '{' . $rec['server'] . '/imap/readonly/novalidate-cert' . ($rec['security'] ? '/' . $rec['security'] : '') . ':' . $port . '}';
$mailbox = @imap_open(imap_utf7_encode($server_str), imap_utf7_encode($rec['login']), imap_utf7_encode($rec['password']), OP_READONLY || OP_SILENT);
$err = imap_errors();
if (!$mailbox || $err) {
    die(Utils_TooltipCommon::create(__('Connection error'), $err, false));
}
$uns = @imap_search($mailbox, 'UNSEEN ALL');
$unseen = array();
if ($uns) {
    $l = @imap_fetch_overview($mailbox, implode(',', $uns), 0);
    $err = imap_errors();
    if (!$l || $err) {
        die('error reading messages overview');
    }
    foreach ($l as $msg) {
        $from = isset($msg->from) ? $msg->from : '<unknown>';
        $subject = isset($msg->subject) ? $msg->subject : '<no subject>';
开发者ID:62BRAINS,项目名称:EPESI,代码行数:31,代码来源:applet_refresh.php


示例19: iso8859Decode

 function iso8859Decode($text)
 {
     return imap_utf7_encode($text);
 }
开发者ID:sitracker,项目名称:sitracker_old,代码行数:4,代码来源:fetchSitMail.class.php


示例20: convert_encoding

 static function convert_encoding($string, $to, $from = '')
 {
     // Convert string to ISO_8859-1
     if ($from == "UTF-8") {
         $iso_string = utf8_decode($string);
     } else {
         if ($from == "UTF7-IMAP") {
             $iso_string = imap_utf7_decode($string);
         } else {
             $iso_string = $string;
         }
     }
     // Convert ISO_8859-1 string to result coding
     if ($to == "UTF-8") {
         return utf8_encode($iso_string);
     } else {
         if ($to == "UTF7-IMAP") {
             return imap_utf7_encode($iso_string);
         } else {
             return $iso_string;
         }
     }
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:23,代码来源:SceauTools.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imap_utf8函数代码示例发布时间:2022-05-15
下一篇:
PHP imap_utf7_decode函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap