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


PHP EmailBox類代碼示例

本文整理匯總了PHP中EmailBox的典型用法代碼示例。如果您正苦於以下問題:PHP EmailBox類的具體用法?PHP EmailBox怎麽用?PHP EmailBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: resolveEmailMessageFromPostData

 /**
  * Given post data and an email message, populate the sender and account on the email message if possible.
  * Also add message recipients and any attachments.
  * @param array $postData
  * @param EmailMessage $emailMessage
  * @param User $userToSendMessagesFrom
  * @return boolean
  */
 public static function resolveEmailMessageFromPostData(array &$postData, CreateEmailMessageForm $emailMessageForm, User $userToSendMessagesFrom)
 {
     $postVariableName = get_class($emailMessageForm);
     Yii::app()->emailHelper->loadOutboundSettingsFromUserEmailAccount($userToSendMessagesFrom);
     $toRecipients = explode(",", $postData[$postVariableName]['recipientsData']['to']);
     // Not Coding Standard
     static::attachRecipientsToMessage($toRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_TO);
     if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'cc') != null) {
         $ccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['cc']);
         // Not Coding Standard
         static::attachRecipientsToMessage($ccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_CC);
     }
     if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'bcc') != null) {
         $bccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['bcc']);
         // Not Coding Standard
         static::attachRecipientsToMessage($bccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_BCC);
     }
     if (isset($postData['filesIds'])) {
         static::attachFilesToMessage($postData['filesIds'], $emailMessageForm->getModel());
     }
     $emailAccount = EmailAccount::getByUserAndName($userToSendMessagesFrom);
     $sender = new EmailMessageSender();
     $sender->fromName = Yii::app()->emailHelper->fromName;
     $sender->fromAddress = Yii::app()->emailHelper->fromAddress;
     $sender->personOrAccount = $userToSendMessagesFrom;
     $emailMessageForm->sender = $sender;
     $emailMessageForm->account = $emailAccount;
     $emailMessageForm->content->textContent = EmailMessageUtil::resolveTextContent(ArrayUtil::getArrayValue($postData[$postVariableName]['content'], 'htmlContent'), null);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessageForm->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
     return $emailMessageForm;
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:40,代碼來源:EmailMessageUtil.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     self::$emailHelperSendEmailThroughTransport = Yii::app()->emailHelper->sendEmailThroughTransport;
     static::$userpsg = UserTestHelper::createBasicUser('userpsg');
     static::$usercstmsmtp = UserTestHelper::createBasicUser('usercstmsmtp');
     static::$basicuser = UserTestHelper::createBasicUser('basicuser');
     static::$bothSGandCstmUser = UserTestHelper::createBasicUser('bothSGandCstmUser');
     $someoneSuper = UserTestHelper::createBasicUser('someoneSuper');
     $group = Group::getByName('Super Administrators');
     $group->users->add($someoneSuper);
     $saved = $group->save();
     assert($saved);
     // Not Coding Standard
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     if (EmailMessageTestHelper::isSetEmailAccountsTestConfiguration()) {
         EmailMessageTestHelper::createEmailAccountForMailerFactory(static::$usercstmsmtp);
         EmailMessageTestHelper::createEmailAccountForMailerFactory(static::$bothSGandCstmUser);
     }
     SendGrid::register_autoloader();
     Smtpapi::register_autoloader();
     if (SendGridTestHelper::isSetSendGridAccountTestConfiguration()) {
         SendGridTestHelper::createSendGridEmailAccount(static::$userpsg);
         SendGridTestHelper::createSendGridEmailAccount(static::$bothSGandCstmUser);
         Yii::app()->sendGridEmailHelper->apiUsername = Yii::app()->params['emailTestAccounts']['sendGridGlobalSettings']['apiUsername'];
         Yii::app()->sendGridEmailHelper->apiPassword = Yii::app()->params['emailTestAccounts']['sendGridGlobalSettings']['apiPassword'];
         Yii::app()->sendGridEmailHelper->setApiSettings();
         Yii::app()->sendGridEmailHelper->init();
     }
     // Delete item from jobQueue, that is created when new user is created
     Yii::app()->jobQueue->deleteAll();
 }
開發者ID:KulturedKitsch,項目名稱:kulturedkitsch.info,代碼行數:33,代碼來源:ZurmoMailerFactoryTest.php

示例3: createDraftSendGridSystemEmail

 public static function createDraftSendGridSystemEmail($subject, User $owner)
 {
     $emailMessage = new EmailMessage();
     $emailMessage->owner = $owner;
     $emailMessage->subject = $subject;
     //Set sender, and recipient, and content
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'My First Message';
     $emailContent->htmlContent = 'Some fake HTML content';
     $emailMessage->content = $emailContent;
     //Sending from the system, does not have a 'person'.
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'system@somewhere.com';
     $sender->fromName = 'Zurmo System';
     $emailMessage->sender = $sender;
     //Recipient is billy.
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'billy@fakeemail.com';
     $recipient->toName = 'Billy James';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $emailMessage->recipients->add($recipient);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     //Save, at this point the email should be in the draft folder
     $saved = $emailMessage->save();
     if (!$saved) {
         throw new NotSupportedException();
     }
     return $emailMessage;
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:30,代碼來源:SendGridTestHelper.php

示例4: testRun

 public function testRun()
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     //Create 2 sent notifications, and set one with a date over a week ago (8 days ago) for the modifiedDateTime
     $emailMessage = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
     $emailMessage->folder = $folder;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $modifiedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
     $sql = "Update item set modifieddatetime = '" . $modifiedDateTime . "' where id = " . $emailMessage->getClassId('Item');
     ZurmoRedBean::exec($sql);
     $emailMessage2 = EmailMessageTestHelper::createDraftSystemEmail('My Email Message 2', $super);
     $emailMessage2->folder = $folder;
     $saved = $emailMessage2->save();
     $this->assertTrue($saved);
     $this->assertEquals(2, EmailMessage::getCount());
     $job = new ClearSentNotificationsEmailJob();
     $this->assertTrue($job->run());
     $emailMessages = EmailMessage::getAll();
     $this->assertEquals(1, count($emailMessages));
     $this->assertEquals($emailMessage2->id, $emailMessages[0]->id);
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:26,代碼來源:ClearSentNotificationsEmailJobTest.php

示例5: testRun

 public function testRun()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $outboxFolder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
     $sentFolder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     $emailMessage = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
     $emailMessage->folder = $outboxFolder;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $emailMessageId = $emailMessage->id;
     $emailMessage->forget();
     unset($emailMessage);
     $emailMessage2 = EmailMessageTestHelper::createDraftSystemEmail('My Email Message', $super);
     $emailMessage2->folder = $outboxFolder;
     $saved = $emailMessage2->save();
     $this->assertTrue($saved);
     $emailMessage2Id = $emailMessage2->id;
     $emailMessage2->forget();
     unset($emailMessage2);
     $this->assertEquals(2, EmailMessage::getCount());
     $job = new ProcessOutboundEmailJob();
     $this->assertTrue($job->run());
     $emailMessages = EmailMessage::getAll();
     $this->assertEquals(2, count($emailMessages));
     $emailMessage = EmailMessage::getById($emailMessageId);
     $this->assertEquals($sentFolder, $emailMessage->folder);
     $emailMessage2 = EmailMessage::getById($emailMessage2Id);
     $this->assertEquals($sentFolder, $emailMessage2->folder);
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:31,代碼來源:ProcessOutboundEmailJobTest.php

示例6: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     AllPermissionsOptimizationUtil::rebuild();
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:7,代碼來源:EmailArchivingUtilTest.php

示例7: testRenderSummaryContentWithEmailMessage

 /**
  * Testing that each model type can render properly and does not throw an exception
  */
 public function testRenderSummaryContentWithEmailMessage()
 {
     $super = User::getByUsername('super');
     $billy = User::getByUsername('billy');
     $this->assertEquals(0, EmailMessage::getCount());
     $emailMessage = new EmailMessage();
     $emailMessage->owner = BaseControlUserConfigUtil::getUserToRunAs();
     $emailMessage->subject = 'My First Email';
     //Set sender, and recipient, and content
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'My First Message';
     $emailContent->htmlContent = 'Some fake HTML content';
     $emailMessage->content = $emailContent;
     //Sending from the system, does not have a 'person'.
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'system@somewhere.com';
     $sender->fromName = 'Zurmo System';
     $sender->personsOrAccounts->add($super);
     $emailMessage->sender = $sender;
     //Recipient is billy.
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'billy@fakeemail.com';
     $recipient->toName = 'Billy James';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $recipient->personsOrAccounts->add($billy);
     $emailMessage->recipients->add($recipient);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $content = ActivitiesUtil::renderSummaryContent($emailMessage, 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL, 'HomeModule');
     $content = ActivitiesUtil::renderSummaryContent($emailMessage, 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER, 'HomeModule');
     $content = ActivitiesUtil::renderSummaryContent($emailMessage, 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL, 'UserModule');
     $content = ActivitiesUtil::renderSummaryContent($emailMessage, 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER, 'UserModule');
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:38,代碼來源:ActivitiesUtilTest.php

示例8: actionCategory

 public function actionCategory()
 {
     $uid = Yii::app()->user->uid;
     $myFolders = EmailBox::model()->fetchAllNotSysByUid($uid);
     $notReadCount = Email::model()->countNotReadByToid($uid, "inbox");
     $return = array("folders" => $myFolders, "notread" => $notReadCount);
     $this->ajaxReturn($return, "JSONP");
 }
開發者ID:AxelPanda,項目名稱:ibos,代碼行數:8,代碼來源:MailController.php

示例9: getCategory

 public function getCategory()
 {
     $gUid = Ibos::app()->user->uid;
     $myFolders = EmailBox::model()->fetchAllNotSysByUid($gUid);
     $notReadCount = Email::model()->countNotReadByToid($gUid, "inbox");
     $return = array("folders" => $myFolders, "notread" => $notReadCount);
     return $return;
 }
開發者ID:AxelPanda,項目名稱:ibos,代碼行數:8,代碼來源:MICMail.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
     $emailBoxes = EmailBox::getAll();
     $this->emailBox = $emailBoxes[0];
     $this->marketingList = MarketingListTestHelper::createMarketingListByName('Test Marketing List');
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:8,代碼來源:MarketingListGrowthChartDataProviderTest.php

示例11: testCreateEmailMessageThatIsANotification

 /**
  * A notification email is different than a regular outbound email because it is owned by a super user
  * that is different than the user logged in.  So the sender does not have a 'person'
  */
 public function testCreateEmailMessageThatIsANotification()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $billy = User::getByUsername('billy');
     $this->assertEquals(0, EmailMessage::getCount());
     $emailMessage = new EmailMessage();
     $emailMessage->owner = BaseControlUserConfigUtil::getUserToRunAs();
     $emailMessage->subject = 'My First Email';
     //Set sender, and recipient, and content
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'My First Message';
     $emailContent->htmlContent = 'Some fake HTML content';
     $emailMessage->content = $emailContent;
     //Sending from the system, does not have a 'person'.
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'system@somewhere.com';
     $sender->fromName = 'Zurmo System';
     $emailMessage->sender = $sender;
     //Recipient is billy.
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'billy@fakeemail.com';
     $recipient->toName = 'Billy James';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $recipient->personsOrAccounts->add($billy);
     $emailMessage->recipients->add($recipient);
     //At this point the message is in no folder
     $this->assertTrue($emailMessage->folder->id < 0);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     //Save, at this point the email should be in the draft folder
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $this->assertTrue($emailMessage->folder->id > 0);
     $this->assertEquals(0, EmailMessageSendError::getCount());
     $emailMessageSendError = new EmailMessageSendError();
     $data = array();
     $data['message'] = 'error message';
     $emailMessageSendError->serializedData = serialize($data);
     $emailMessage->folder = EmailFolder::getByBoxAndType($emailMessage->folder->emailBox, EmailFolder::TYPE_OUTBOX_ERROR);
     $emailMessage->error = $emailMessageSendError;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $this->assertEquals(1, EmailMessageSendError::getCount());
     //Now swap the error with a new one
     $emailMessageId = $emailMessage->id;
     $emailMessage->forget();
     $emailMessage = EmailMessage::getById($emailMessageId);
     $emailMessageSendError = new EmailMessageSendError();
     $data = array();
     $data['message'] = 'error message 2';
     $emailMessageSendError->serializedData = serialize($data);
     $emailMessage->error = $emailMessageSendError;
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $this->assertEquals(1, EmailMessageSendError::getCount());
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:61,代碼來源:EmailMessageSendErrorTest.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
     $emailBoxes = EmailBox::getAll();
     $this->emailBox = $emailBoxes[0];
     $this->marketingList = MarketingListTestHelper::createMarketingListByName('Test Marketing List');
     $this->campaign = CampaignTestHelper::createCampaign('Test Campaing 01', 'text', 'text exemple');
     $this->autoresponder = AutoresponderTestHelper::createAutoresponder('Test Autoresponder 01', 'text', 'html', 60, Autoresponder::OPERATION_SUBSCRIBE, true);
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:10,代碼來源:MarketingEmailsInThisListChartDataProviderTest.php

示例13: createBoxAndDefaultFoldersByUserAndName

 /**
  * Given a box name and user, create an email box with the default folders.
  * @param User $user
  * @param string $name
  */
 public static function createBoxAndDefaultFoldersByUserAndName(User $user, $name)
 {
     assert('$user->id > 0');
     assert('is_string($name)');
     $box = new EmailBox();
     $box->name = $name;
     $box->user = $user;
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultDraftName();
     $folder->type = EmailFolder::TYPE_DRAFT;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultInboxName();
     $folder->type = EmailFolder::TYPE_INBOX;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultSentName();
     $folder->type = EmailFolder::TYPE_SENT;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxName();
     $folder->type = EmailFolder::TYPE_OUTBOX;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxErrorName();
     $folder->type = EmailFolder::TYPE_OUTBOX_ERROR;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxFailureName();
     $folder->type = EmailFolder::TYPE_OUTBOX_FAILURE;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultArchivedName();
     $folder->type = EmailFolder::TYPE_ARCHIVED;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultArchivedUnmatchedName();
     $folder->type = EmailFolder::TYPE_ARCHIVED_UNMATCHED;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $saved = $box->save();
     if (!$saved) {
         throw new NotSupportedException();
     }
     return $box;
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:58,代碼來源:EmailBoxUtil.php

示例14: resolveSearchAttributeDataForAllLatestActivities

 public function resolveSearchAttributeDataForAllLatestActivities($searchAttributeData)
 {
     assert('is_array($searchAttributeData)');
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $searchAttributeData = parent::resolveSearchAttributeDataForAllLatestActivities($searchAttributeData);
     $clausesCount = count($searchAttributeData['clauses']);
     $searchAttributeData['clauses'][$clausesCount + 1] = array('attributeName' => 'folder', 'relatedModelData' => array('attributeName' => 'emailBox', 'operatorType' => 'doesNotEqual', 'value' => $box->id));
     if ($searchAttributeData['structure'] != null) {
         $searchAttributeData['structure'] .= ' and ';
     }
     $searchAttributeData['structure'] .= $clausesCount + 1;
     return $searchAttributeData;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:13,代碼來源:EmailMessageMashableActivityRules.php

示例15: run

 /**
  *
  * (non-PHPdoc)
  * @see BaseJob::run()
  */
 public function run()
 {
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $oneWeekAgoTimeStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 7);
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'modifiedDateTime', 'operatorType' => 'lessThan', 'value' => $oneWeekAgoTimeStamp), 2 => array('attributeName' => 'folder', 'relatedAttributeName' => 'type', 'operatorType' => 'equals', 'value' => EmailFolder::TYPE_SENT), 3 => array('attributeName' => 'folder', 'relatedAttributeName' => 'emailBox', 'operatorType' => 'equals', 'value' => $box->id));
     $searchAttributeData['structure'] = '1 and 2 and 3';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('EmailMessage');
     $where = RedBeanModelDataProvider::makeWhere('EmailMessage', $searchAttributeData, $joinTablesAdapter);
     $emailMessageModels = EmailMessage::getSubset($joinTablesAdapter, null, self::$pageSize, $where, null);
     foreach ($emailMessageModels as $emailMessage) {
         $emailMessage->delete();
     }
     return true;
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:20,代碼來源:ClearSentNotificationsEmailJob.php


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