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


PHP InboundEmail::retrieveAllByGroupIdWithGroupAccounts方法代碼示例

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


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

示例1: listMailConfigurations

 /**
  * @access public
  * @param User         $user    required
  * @param Localization $locale
  * @param string       $charset
  * @return array MailConfigurations
  * @throws MailerException
  */
 public static function listMailConfigurations(User $user, Localization $locale = null, $charset = null)
 {
     global $app_strings;
     $outboundEmailConfigurations = array();
     $ret = $user->getUsersNameAndEmail();
     $systemDefaultOutbound = null;
     if (empty($ret['email'])) {
         $systemReturn = $user->getSystemDefaultNameAndEmail();
         $ret['email'] = $systemReturn['email'];
         $ret['name'] = $systemReturn['name'];
         $system_replyToAddress = $ret['email'];
     } else {
         $system_replyToAddress = '';
     }
     $system_replyToName = $ret['name'];
     $replyTo = $user->emailAddress->getReplyToAddress($user, true);
     if (!empty($replyTo)) {
         $system_replyToAddress = $replyTo;
     }
     /* Retrieve any Inbound User Mail Accounts and the Outbound Mail Accounts Associated with them */
     $inboundEmail = new InboundEmail();
     $ieAccounts = $inboundEmail->retrieveAllByGroupIdWithGroupAccounts($user->id);
     $ie_ids = array_keys($ieAccounts);
     foreach ($ieAccounts as $inbox_id => $ie) {
         $name = $ie->get_stored_options('from_name');
         $addr = $ie->get_stored_options('from_addr');
         $storedOptions = unserialize(base64_decode($ie->stored_options));
         $isAllowedGroup = $ie->get_stored_options('allow_outbound_group_usage', false);
         if (!$ie->is_personal && !$isAllowedGroup) {
             continue;
         }
         $outbound_config_id = empty($storedOptions["outbound_email"]) ? null : $storedOptions["outbound_email"];
         $oe = null;
         if (!empty($outbound_config_id)) {
             $oe = static::loadOutboundEmail();
             $oe->retrieve($outbound_config_id);
         } else {
             if (empty($systemDefaultOutbound)) {
                 $systemDefaultOutbound = self::getSystemMailConfiguration($user, $locale, $charset);
             }
             $outbound_config_id = $systemDefaultOutbound->getConfigId();
             $oe = static::loadOutboundEmail();
             $oe->retrieve($outbound_config_id);
         }
         if ($name != null && $addr != null && !empty($outbound_config_id) && !empty($oe) && $outbound_config_id == $oe->id) {
             // turn the OutboundEmail object into a useable set of mail configurations
             $configurations = array();
             $configurations["config_id"] = $outbound_config_id;
             $configurations["config_type"] = "user";
             $configurations["inbox_id"] = $inbox_id;
             $configurations["from_email"] = $addr;
             $configurations["from_name"] = $name;
             if ($isAllowedGroup) {
                 $configurations["display_name"] = "{$name} ({$addr}) - [" . $app_strings['LBL_GROUP_EMAIL_ACCOUNT_CONFIGURATION'] . "]";
             } else {
                 $configurations["display_name"] = "{$name} ({$addr}) - [" . $app_strings['LBL_USER_OUTBOUND_EMAIL_ACCOUNT_CONFIGURATION'] . "]";
             }
             $configurations["personal"] = (bool) $ie->is_personal;
             $configurations["replyto_email"] = !empty($storedOptions["reply_to_addr"]) ? $storedOptions["reply_to_addr"] : $addr;
             $configurations["replyto_name"] = !empty($storedOptions["reply_to_name"]) ? $storedOptions["reply_to_name"] : $name;
             $outboundEmailConfiguration = self::buildOutboundEmailConfiguration($user, $configurations, $oe, $locale, $charset);
             $outboundEmailConfigurations[] = $outboundEmailConfiguration;
         }
     }
     $systemUser = BeanFactory::getBean("Users");
     $systemUser->getSystemUser();
     $oe = static::loadOutboundEmail();
     $systemMailerConfiguration = $oe->getSystemMailerSettings();
     if ($oe->isAllowUserAccessToSystemDefaultOutbound()) {
         $system = $systemMailerConfiguration;
         $personal = false;
     } else {
         $system = $oe->getUsersMailerForSystemOverride($user->id);
         $personal = true;
         if (empty($system)) {
             // Create a User System-Override Configuration
             if ($user->id == $systemUser->id) {
                 $oe = $oe->createUserSystemOverrideAccount($user->id, $systemMailerConfiguration->mail_smtpuser, $systemMailerConfiguration->mail_smtppass);
             } else {
                 $oe = $oe->createUserSystemOverrideAccount($user->id);
             }
             $system = $oe->getUsersMailerForSystemOverride($user->id);
         }
     }
     if (empty($system->id)) {
         throw new MailerException("No Valid Mail Configurations Found", MailerException::InvalidConfiguration);
     }
     // turn the OutboundEmail object into a useable set of mail configurations
     $oe = static::loadOutboundEmail();
     $oe->retrieve($system->id);
     $configurations = array();
     $configurations["config_id"] = $system->id;
//.........這裏部分代碼省略.........
開發者ID:jglaine,項目名稱:sugar761-ent,代碼行數:101,代碼來源:OutboundEmailConfigurationPeer.php

示例2: retrieveAllByGroupIdWithGroupAccounts

 public function retrieveAllByGroupIdWithGroupAccounts($group_id)
 {
     $inboundEmail = new InboundEmail();
     $result = $inboundEmail->retrieveAllByGroupIdWithGroupAccounts($group_id);
     $this->assertTrue(is_array($result));
     foreach ($result as $ie) {
         $this->assertInstanceOf('InboundEmail', $ie);
     }
 }
開發者ID:sacredwebsite,項目名稱:SuiteCRM,代碼行數:9,代碼來源:InboundEmailTest.php


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