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


PHP EmailFolder::getByBoxAndType方法代码示例

本文整理汇总了PHP中EmailFolder::getByBoxAndType方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailFolder::getByBoxAndType方法的具体用法?PHP EmailFolder::getByBoxAndType怎么用?PHP EmailFolder::getByBoxAndType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EmailFolder的用法示例。


在下文中一共展示了EmailFolder::getByBoxAndType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

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

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

示例3: 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 CreateEmailMessageForm $emailMessageForm
  * @param User $userToSendMessagesFrom
  * @return CreateEmailMessageForm
  */
 public static function resolveEmailMessageFromPostData(array &$postData, CreateEmailMessageForm $emailMessageForm, User $userToSendMessagesFrom)
 {
     $postVariableName = get_class($emailMessageForm);
     $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 = $emailAccount->fromName;
     $sender->fromAddress = $emailAccount->fromAddress;
     $sender->personsOrAccounts->add($userToSendMessagesFrom);
     $emailMessageForm->sender = $sender;
     $emailMessageForm->account = $emailAccount;
     $box = EmailBoxUtil::getDefaultEmailBoxByUser($userToSendMessagesFrom);
     $emailMessageForm->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
     return $emailMessageForm;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:38,代码来源:EmailMessageUtil.php

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

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

示例7: sendEmail

 /**
  * Override to avoid actually sending emails out through transport.
  * (non-PHPdoc)
  * @see EmailHelper::sendEmail()
  */
 protected function sendEmail(Mailer $mailer, EmailMessage $emailMessage)
 {
     if (!$this->sendEmailThroughTransport) {
         $emailMessage->error = null;
         $emailMessage->folder = EmailFolder::getByBoxAndType($emailMessage->folder->emailBox, EmailFolder::TYPE_SENT);
     } else {
         parent::sendEmail($mailer, $emailMessage);
     }
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:14,代码来源:EmailHelperForTesting.php

示例8: sendEmail

 /**
  * Override to avoid actually sending emails out through transport.
  * (non-PHPdoc)
  * @see ZurmoSwiftMailer::sendEmail()
  */
 public function sendEmail()
 {
     $emailMessage = $this->emailMessage;
     $sendEmailThroughTransport = Yii::app()->emailHelper->sendEmailThroughTransport;
     if (!$sendEmailThroughTransport) {
         $emailMessage->error = null;
         $emailMessage->folder = EmailFolder::getByBoxAndType($emailMessage->folder->emailBox, EmailFolder::TYPE_SENT);
         $emailMessage->sendAttempts = $emailMessage->sendAttempts + 1;
         $emailMessage->save();
     } else {
         parent::sendEmail();
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:ZurmoSwiftMailerForTesting.php

示例9: process

 /**
  * @throws MissingRecipientsForEmailMessageException
  */
 public function process()
 {
     $emailTemplate = EmailTemplate::getById((int) $this->emailMessageForm->emailTemplateId);
     $emailMessage = new EmailMessage();
     $emailMessage->owner = $this->triggeredByUser;
     $emailMessage->subject = $this->resolveEmailTemplateSubjectForModelData($emailTemplate);
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = $this->resolveEmailTemplateTextContentForModelData($emailTemplate);
     $emailContent->htmlContent = $this->resolveEmailTemplateHtmlContentForModelData($emailTemplate);
     $emailMessage->content = $emailContent;
     $emailMessage->sender = $this->resolveSender();
     $this->resolveRecipients($emailMessage);
     if ($emailMessage->recipients->count() == 0) {
         throw new MissingRecipientsForEmailMessageException();
     }
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     Yii::app()->emailHelper->send($emailMessage);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:22,代码来源:WorkflowEmailMessageProcessingHelper.php

示例10: makeEmailMessage

 protected function makeEmailMessage(Contact $contact, $subject = null)
 {
     $interval = mt_rand(4, 35) * 86400;
     if (!isset($subject)) {
         $subject = 'A test archived sent email';
     }
     //#1 Create Archived - Sent
     $emailMessage = new EmailMessage();
     $emailMessage->setScenario('importModel');
     $emailMessage->owner = $contact->owner;
     $emailMessage->subject = $subject;
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'My First Message';
     $emailContent->htmlContent = 'Some fake HTML content';
     $emailMessage->content = $emailContent;
     //Sending is current user (super)
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'super@zurmotest.com';
     $sender->fromName = 'Super User';
     $sender->personsOrAccounts->add(Yii::app()->user->userModel);
     $emailMessage->sender = $sender;
     //Recipient is BobMessage
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'bob.message@zurmotest.com';
     $recipient->toName = strval($contact);
     $recipient->personsOrAccounts->add($contact);
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $emailMessage->recipients->add($recipient);
     $emailMessage->folder = EmailFolder::getByBoxAndType($this->emailBox, EmailFolder::TYPE_SENT);
     $emailMessage->createdDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - $interval);
     $emailMessage->sentDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - $interval + mt_rand(0, 3) * 86400);
     $emailMessage->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
     $saved = $emailMessage->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     $emailMessage = EmailMessage::getById($emailMessage->id);
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($emailMessage, Group::getByName(Group::EVERYONE_GROUP_NAME));
     $emailMessage->save();
     return $emailMessage;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:41,代码来源:EmailMessageActivitiesDemoDataMaker.php

示例11: testExportRelationAttributes

 public function testExportRelationAttributes()
 {
     $report = new Report();
     $report->setType(Report::TYPE_ROWS_AND_COLUMNS);
     $report->setModuleClassName('EmailMessagesModule');
     $report->setFiltersStructure('');
     $emailMessage = new EmailMessage();
     $emailMessage->owner = Yii::app()->user->userModel;
     $emailMessage->subject = 'A test email';
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'A test text message from Zurmo.';
     $emailContent->htmlContent = 'A test text message from Zurmo.';
     $emailMessage->content = $emailContent;
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'super@zurmo.com';
     $sender->fromName = 'super';
     $sender->personsOrAccounts->add(Yii::app()->user->userModel);
     $emailMessage->sender = $sender;
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'billy@joe.com';
     $recipient->toName = 'Test Recipient';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $emailMessage->recipients->add($recipient);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     $this->assertTrue($emailMessage->save());
     $displayAttribute1 = new DisplayAttributeForReportForm('EmailMessagesModule', 'EmailMessage', Report::TYPE_ROWS_AND_COLUMNS);
     $displayAttribute1->setModelAliasUsingTableAliasName('relatedModel');
     $displayAttribute1->attributeIndexOrDerivedType = 'sender___User__personsOrAccounts__Inferred___firstName';
     $report->addDisplayAttribute($displayAttribute1);
     $displayAttribute2 = new DisplayAttributeForReportForm('EmailMessagesModule', 'EmailMessage', Report::TYPE_ROWS_AND_COLUMNS);
     $displayAttribute2->setModelAliasUsingTableAliasName('relatedModel');
     $displayAttribute2->attributeIndexOrDerivedType = 'sender___Contact__personsOrAccounts__Inferred___firstName';
     $report->addDisplayAttribute($displayAttribute2);
     $dataProvider = new RowsAndColumnsReportDataProvider($report);
     $adapter = ReportToExportAdapterFactory::createReportToExportAdapter($report, $dataProvider);
     $compareHeaderData = array('Sender >> Users >> First Name', 'Sender >> Contacts >> First Name');
     $compareRowData = array(array('Clark', ''));
     $this->assertEquals($compareHeaderData, $adapter->getHeaderData());
     $this->assertEquals($compareRowData, $adapter->getData());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:41,代码来源:EmailMessagesRowsAndColumnsReportToExportAdapterTest.php

示例12: run

 /**
  *
  * (non-PHPdoc)
  * @see BaseJob::run()
  */
 public function run()
 {
     $messageContent = null;
     $userToSendMessagesFrom = BaseControlUserConfigUtil::getUserToRunAs();
     $emailMessage = new EmailMessage();
     $emailMessage->owner = Yii::app()->user->userModel;
     $emailMessage->subject = Zurmo::t('EmailMessagesModule', 'A test email from Zurmo', LabelUtil::getTranslationParamsForAllModules());
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = Zurmo::t('EmailMessagesModule', 'A test text message from Zurmo.', LabelUtil::getTranslationParamsForAllModules());
     $emailContent->htmlContent = Zurmo::t('EmailMessagesModule', 'A test text message from Zurmo.', LabelUtil::getTranslationParamsForAllModules());
     $emailMessage->content = $emailContent;
     $sender = new EmailMessageSender();
     $sender->fromAddress = Yii::app()->emailHelper->resolveFromAddressByUser($userToSendMessagesFrom);
     $sender->fromName = Yii::app()->emailHelper->resolveFromNameForSystemUser($userToSendMessagesFrom);
     $emailMessage->sender = $sender;
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = Yii::app()->emailHelper->defaultTestToAddress;
     $recipient->toName = 'Test Recipient';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $emailMessage->recipients->add($recipient);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     $validatedAndSaved = $emailMessage->save();
     if (!$validatedAndSaved) {
         throw new NotSupportedException();
     }
     Yii::app()->emailHelper->sendImmediately($emailMessage);
     if (!$emailMessage->hasSendError()) {
         $messageContent .= Zurmo::t('EmailMessagesModule', 'Message successfully sent') . "\n";
         return true;
     } else {
         $messageContent .= Zurmo::t('EmailMessagesModule', 'Message failed to send') . "\n";
         $messageContent .= $emailMessage->error . "\n";
         $this->errorMessage = $messageContent;
         return false;
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:42,代码来源:TestOutboundEmailJob.php

示例13: resolveEmailMessage

 protected static function resolveEmailMessage(EmailTemplate $emailTemplate, Contact $contact = null, $htmlContent, $emailAddress = null)
 {
     // TODO: @Shoaibi: Critical: Refactor this and AutoresponderAndCampaignItemsUtil
     $emailMessage = new EmailMessage();
     $emailMessage->subject = $emailTemplate->subject;
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = $emailTemplate->textContent;
     // we do not need to do : EmailTemplateSerializedDataToHtmlUtil::resolveHtmlByEmailTemplateModel($emailTemplate);
     // check __set of EmailTemplate.
     $emailContent->htmlContent = $htmlContent;
     $emailMessage->content = $emailContent;
     $emailMessage->sender = static::resolveSender();
     static::resolveRecipient($emailMessage, $contact, $emailAddress);
     $box = EmailBox::resolveAndGetByName(EmailBox::USER_DEFAULT_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     Yii::app()->emailHelper->sendImmediately($emailMessage);
     $emailMessage->owner = $emailTemplate->owner;
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($emailTemplate);
     ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($emailMessage, $explicitReadWriteModelPermissions);
     if (!$emailMessage->save()) {
         throw new FailedToSaveModelException("Unable to save EmailMessage");
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:23,代码来源:DefaultController.php

示例14: createEmailMessage

 private function createEmailMessage($contact, $emailMessageSentDateTime)
 {
     $emailBox = $this->emailBox;
     $emailMessage = new EmailMessage();
     $emailMessage->setScenario('importModel');
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = 'My First Message';
     $emailContent->htmlContent = 'Some fake HTML content';
     $sender = new EmailMessageSender();
     $sender->fromAddress = 'super@zurmotest.com';
     $sender->fromName = 'Super User';
     $sender->personOrAccount = Yii::app()->user->userModel;
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'test.to@zurmotest.com';
     $recipient->toName = strval($contact);
     $recipient->personOrAccount = $contact;
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $emailMessage->owner = Yii::app()->user->userModel;
     $emailMessage->subject = 'A test archived sent email';
     $emailMessage->content = $emailContent;
     $emailMessage->sender = $sender;
     if (isset($emailMessageSentDateTime)) {
         $emailMessage->sentDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(strtotime($emailMessageSentDateTime));
         $emailMessage->createdDateTime = $emailMessage->sentDateTime;
     }
     $emailMessage->folder = EmailFolder::getByBoxAndType($emailBox, EmailFolder::TYPE_ARCHIVED);
     $emailMessage->recipients->add($recipient);
     return $emailMessage;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:29,代码来源:MarketingEmailsInThisListChartDataProviderTest.php

示例15: resolveEmailMessage

 protected function resolveEmailMessage($subject = 'Subject', $textContent = 'My First Message', $htmlContent = 'Some fake HTML content', $fromAddress = 'zurmo@zurmo.org', $fromName = 'Zurmo', $toAddress = 'bob.message@zurmotest.com', $toName = null, $contact = null)
 {
     if (!isset($contact)) {
         $contact = ContactTestHelper::createContactByNameForOwner('emailContact', Yii::app()->user->userModel);
     }
     $emailMessage = new EmailMessage();
     $emailMessage->owner = $contact->owner;
     $emailMessage->subject = $subject;
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = $textContent;
     $emailContent->htmlContent = $htmlContent;
     $emailMessage->content = $emailContent;
     $sender = new EmailMessageSender();
     $sender->fromAddress = $fromAddress;
     $sender->fromName = $fromName;
     $sender->personsOrAccounts->add(Yii::app()->user->userModel);
     $emailMessage->sender = $sender;
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = $toAddress;
     if (!isset($toName)) {
         $toName = strval($contact);
     }
     $recipient->toName = $toName;
     $recipient->personsOrAccounts->add($contact);
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $emailMessage->recipients->add($recipient);
     $emailBox = EmailBoxUtil::getDefaultEmailBoxByUser(Yii::app()->user->userModel);
     $emailMessage->folder = EmailFolder::getByBoxAndType($emailBox, EmailFolder::TYPE_OUTBOX);
     $saved = $emailMessage->save();
     if (!$saved) {
         var_dump($emailMessage->getErrors());
         throw new FailedToSaveModelException();
     }
     return $emailMessage;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:AutoresponderOrCampaignBaseTest.php


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