當前位置: 首頁>>代碼示例>>PHP>>正文


PHP InboundEmail::getConnectString方法代碼示例

本文整理匯總了PHP中InboundEmail::getConnectString方法的典型用法代碼示例。如果您正苦於以下問題:PHP InboundEmail::getConnectString方法的具體用法?PHP InboundEmail::getConnectString怎麽用?PHP InboundEmail::getConnectString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在InboundEmail的用法示例。


在下文中一共展示了InboundEmail::getConnectString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: SugarPHPMailer


//.........這裏部分代碼省略.........
         if (isset($_REQUEST['ieId']) && isset($_REQUEST['mbox'])) {
             $emailFromIe = new InboundEmail();
             $emailFromIe->retrieve($_REQUEST['ieId']);
             $emailFromIe->mailbox = $_REQUEST['mbox'];
             if (isset($emailFromIe->id) && $emailFromIe->is_personal) {
                 if ($emailFromIe->isPop3Protocol()) {
                     $emailFromIe->mark_answered($this->uid, 'pop3');
                 } elseif ($emailFromIe->connectMailserver() == 'true') {
                     $emailFromIe->markEmails($this->uid, 'answered');
                     $emailFromIe->mark_answered($this->uid);
                 }
             }
         }
     }
     if ($forceSave || $this->type == 'draft' || isset($request['saveToSugar']) && $request['saveToSugar'] == 1) {
         // saving a draft OR saving a sent email
         $decodedFromName = mb_decode_mimeheader($mail->FromName);
         $this->from_addr = "{$decodedFromName} <{$mail->From}>";
         $this->from_addr_name = $this->from_addr;
         $this->to_addrs = $_REQUEST['sendTo'];
         $this->to_addrs_names = $_REQUEST['sendTo'];
         $this->cc_addrs = $_REQUEST['sendCc'];
         $this->cc_addrs_names = $_REQUEST['sendCc'];
         $this->bcc_addrs = $_REQUEST['sendBcc'];
         $this->bcc_addrs_names = $_REQUEST['sendBcc'];
         $this->assigned_user_id = $current_user->id;
         $this->date_sent = $timedate->now();
         ///////////////////////////////////////////////////////////////////
         ////	LINK EMAIL TO SUGARBEANS BASED ON EMAIL ADDY
         if (isset($_REQUEST['parent_type']) && !empty($_REQUEST['parent_type']) && isset($_REQUEST['parent_id']) && !empty($_REQUEST['parent_id'])) {
             $this->parent_id = $_REQUEST['parent_id'];
             $this->parent_type = $_REQUEST['parent_type'];
             $q = "SELECT count(*) c FROM emails_beans WHERE  email_id = '{$this->id}' AND bean_id = '{$_REQUEST['parent_id']}' AND bean_module = '{$_REQUEST['parent_type']}'";
             $r = $this->db->query($q);
             $a = $this->db->fetchByAssoc($r);
             if ($a['c'] <= 0) {
                 if (isset($beanList[$_REQUEST['parent_type']]) && !empty($beanList[$_REQUEST['parent_type']])) {
                     $className = $beanList[$_REQUEST['parent_type']];
                     if (isset($beanFiles[$className]) && !empty($beanFiles[$className])) {
                         if (!class_exists($className)) {
                             require_once $beanFiles[$className];
                         }
                         $bean = new $className();
                         $bean->retrieve($_REQUEST['parent_id']);
                         if ($bean->load_relationship('emails')) {
                             $bean->emails->add($this->id);
                         }
                         // if
                     }
                     // if
                 }
                 // if
             }
             // if
         } else {
             if (!class_exists('aCase')) {
             } else {
                 $c = new aCase();
                 if ($caseId = InboundEmail::getCaseIdFromCaseNumber($mail->Subject, $c)) {
                     $c->retrieve($caseId);
                     $c->load_relationship('emails');
                     $c->emails->add($this->id);
                     $this->parent_type = "Cases";
                     $this->parent_id = $caseId;
                 }
                 // if
             }
         }
         // else
         ////	LINK EMAIL TO SUGARBEANS BASED ON EMAIL ADDY
         ///////////////////////////////////////////////////////////////////
         $this->save();
     }
     if (!empty($request['fromAccount'])) {
         if (isset($ie->id) && !$ie->isPop3Protocol()) {
             $sentFolder = $ie->get_stored_options("sentFolder");
             if (!empty($sentFolder)) {
                 $data = $mail->CreateHeader() . "\r\n" . $mail->CreateBody() . "\r\n";
                 $ie->mailbox = $sentFolder;
                 if ($ie->connectMailserver() == 'true') {
                     $connectString = $ie->getConnectString($ie->getServiceString(), $ie->mailbox);
                     $returnData = imap_append($ie->conn, $connectString, $data, "\\Seen");
                     if (!$returnData) {
                         $GLOBALS['log']->debug("could not copy email to {$ie->mailbox} for {$ie->name}");
                     }
                     // if
                 } else {
                     $GLOBALS['log']->debug("could not connect to mail serve for folder {$ie->mailbox} for {$ie->name}");
                 }
                 // else
             } else {
                 $GLOBALS['log']->debug("could not copy email to {$ie->mailbox} sent folder as its empty");
             }
             // else
         }
         // if
     }
     // if
     return true;
 }
開發者ID:rgauss,項目名稱:sugarcrm_dev,代碼行數:101,代碼來源:Email.php

示例2: testgetConnectString

 public function testgetConnectString()
 {
     $inboundEmail = new InboundEmail();
     $this->assertEquals('{:/service=}', $inboundEmail->getConnectString());
     //test with default options
     $this->assertEquals('{:/service=mail.google.com}INBOX', $inboundEmail->getConnectString('mail.google.com', 'INBOX'));
     //test with includeMbox true
     $this->assertEquals('{:/service=mail.google.com}', $inboundEmail->getConnectString('mail.google.com', 'INBOX', false));
     //test with includeMbox false
 }
開發者ID:sacredwebsite,項目名稱:SuiteCRM,代碼行數:10,代碼來源:InboundEmailTest.php


注:本文中的InboundEmail::getConnectString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。