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

PHP EmailMessage类代码示例

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

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



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

示例1: 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 = '[email protected]';
     $sender->fromName = 'Zurmo System';
     $sender->personsOrAccounts->add($super);
     $emailMessage->sender = $sender;
     //Recipient is billy.
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = '[email protected]';
     $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


示例2: 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 = '[email protected]';
     $sender->fromName = 'Zurmo System';
     $emailMessage->sender = $sender;
     //Recipient is billy.
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = '[email protected]';
     $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


示例3: recurse

 public function recurse($messageParts, $prefix = '', $index = 1, $fullPrefix = true)
 {
     foreach ($messageParts as $part) {
         $partNumber = $prefix . $index;
         if ($part->type == 0) {
             if ($part->subtype == 'PLAIN') {
                 $this->bodyPlain .= $this->getPart($partNumber, $part->encoding);
             } else {
                 $this->bodyHTML .= $this->getPart($partNumber, $part->encoding);
             }
         } elseif ($part->type == 2) {
             $msg = new EmailMessage($this->connection, $this->messageNumber);
             $msg->getAttachments = $this->getAttachments;
             $msg->recurse($part->parts, $partNumber . '.', 0, false);
             $this->attachments[] = array('type' => $part->type, 'subtype' => $part->subtype, 'filename' => '', 'data' => $msg, 'inline' => false);
         } elseif (isset($part->parts)) {
             if ($fullPrefix) {
                 $this->recurse($part->parts, $prefix . $index . '.');
             } else {
                 $this->recurse($part->parts, $prefix);
             }
         } elseif ($part->type > 2) {
             if (isset($part->id)) {
                 $id = str_replace(array('<', '>'), '', $part->id);
                 $this->attachments[$id] = array('type' => $part->type, 'subtype' => $part->subtype, 'filename' => $this->getFilenameFromPart($part), 'data' => $this->getAttachments ? $this->getPart($partNumber, $part->encoding) : '', 'inline' => true);
             } else {
                 $this->attachments[] = array('type' => $part->type, 'subtype' => $part->subtype, 'filename' => $this->getFilenameFromPart($part), 'data' => $this->getAttachments ? $this->getPart($partNumber, $part->encoding) : '', 'inline' => false);
             }
         }
         $index++;
     }
 }
开发者ID:Chendri,项目名称:phpemailclient,代码行数:32,代码来源:EmailMessage.php


示例4: resolveEmailMessage

 protected function resolveEmailMessage($subject = 'Subject', $textContent = 'My First Message', $htmlContent = 'Some fake HTML content', $fromAddress = '[email protected]', $fromName = 'Zurmo', $toAddress = '[email protected]', $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


示例5: addEmailMessageFirstDayOfMonthDateClause

 /**
  * @param RedBeanModelSelectQueryAdapter $selectQueryAdapter
  * @param string $columnName
  */
 protected static function addEmailMessageFirstDayOfMonthDateClause(RedBeanModelSelectQueryAdapter $selectQueryAdapter, $columnName)
 {
     assert('is_string($columnName)');
     $quote = DatabaseCompatibilityUtil::getQuote();
     $emailMessageTableName = EmailMessage::getTableName('EmailMessage');
     $selectQueryAdapter->addFirstDayOfMonthDateClause($emailMessageTableName, $columnName, static::FIRST_DAY_OF_MONTH_DATE);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:MarketingGroupByEmailMessagesChartDataProvider.php


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


示例7: makeSqlQuery

 protected static function makeSqlQuery($searchAttributeData)
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     $where = null;
     $selectDistinct = false;
     $autoresponderTableName = Autoresponder::getTableName('Autoresponder');
     $autoresponderItemTableName = AutoresponderItem::getTableName('AutoresponderItem');
     $emailMessageTableName = EmailMessage::getTableName('EmailMessage');
     $sentDateTimeColumnName = EmailMessage::getColumnNameByAttribute('sentDateTime');
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('Autoresponder');
     $selectQueryAdapter = new RedBeanModelSelectQueryAdapter($selectDistinct);
     $queuedEmailsSelectPart = "sum(CASE WHEN {$quote}{$emailMessageTableName}{$quote}.{$quote}{$sentDateTimeColumnName}" . $quote . " = '0000-00-00 00:00:00' OR {$quote}{$emailMessageTableName}{$quote}" . ".{$quote}{$sentDateTimeColumnName}{$quote} IS NULL THEN 1 ELSE 0 END)";
     // Not Coding Standard
     $sentEmailsSelectPart = "sum(CASE WHEN {$quote}{$emailMessageTableName}{$quote}.{$quote}{$sentDateTimeColumnName}" . $quote . " > '0000-00-00 00:00:00' THEN 1 ELSE 0 END)";
     $uniqueOpensSelectPart = static::resolveAutoresponderTypeSubQuery(EmailMessageActivity::TYPE_OPEN);
     $uniqueClicksSelectPart = static::resolveAutoresponderTypeSubQuery(EmailMessageActivity::TYPE_CLICK);
     $bouncedSelectPart = static::resolveAutoresponderTypeSubQuery(EmailMessageActivity::TYPE_BOUNCE);
     $optedOutSelectPart = static::resolveAutoresponderTypeSubQuery(EmailMessageActivity::TYPE_UNSUBSCRIBE);
     static::addEmailMessageDayDateClause($selectQueryAdapter, $sentDateTimeColumnName);
     static::addEmailMessageFirstDayOfWeekDateClause($selectQueryAdapter, $sentDateTimeColumnName);
     static::addEmailMessageFirstDayOfMonthDateClause($selectQueryAdapter, $sentDateTimeColumnName);
     $selectQueryAdapter->addNonSpecificCountClause();
     $selectQueryAdapter->addClauseByQueryString($queuedEmailsSelectPart, static::QUEUED);
     $selectQueryAdapter->addClauseByQueryString($sentEmailsSelectPart, static::SENT);
     $selectQueryAdapter->addClauseByQueryString("count((" . $uniqueOpensSelectPart . "))", static::UNIQUE_OPENS);
     $selectQueryAdapter->addClauseByQueryString("count((" . $uniqueClicksSelectPart . "))", static::UNIQUE_CLICKS);
     $selectQueryAdapter->addClauseByQueryString("count((" . $bouncedSelectPart . "))", static::BOUNCED);
     $selectQueryAdapter->addClauseByQueryString("count((" . $optedOutSelectPart . "))", static::UNSUBSCRIBED);
     $joinTablesAdapter->addLeftTableAndGetAliasName($autoresponderItemTableName, 'id', $autoresponderTableName, 'autoresponder_id');
     $joinTablesAdapter->addLeftTableAndGetAliasName($emailMessageTableName, 'emailmessage_id', $autoresponderItemTableName, 'id');
     $where = RedBeanModelDataProvider::makeWhere('Autoresponder', $searchAttributeData, $joinTablesAdapter);
     $sql = SQLQueryUtil::makeQuery($autoresponderTableName, $selectQueryAdapter, $joinTablesAdapter, null, null, $where);
     return $sql;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:34,代码来源:AutoresponderGroupedChartDataProvider.php


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


示例9: resolveAndSaveEmailMessage

 public static function resolveAndSaveEmailMessage($textContent, $htmlContent, Item $itemOwnerModel, Contact $contact, MarketingList $marketingList, $itemId, $folderId)
 {
     $recipient = static::resolveRecipient($contact);
     if (empty($recipient)) {
         throw new MissingRecipientsForEmailMessageException();
     }
     $userId = static::resolveCurrentUserId();
     if (get_class($itemOwnerModel) == 'Campaign') {
         $ownerId = $itemOwnerModel->owner->id;
     } else {
         $ownerId = $marketingList->owner->id;
     }
     $subject = $itemOwnerModel->subject;
     $serializedData = serialize($subject);
     $headers = static::resolveHeaders($itemId);
     $nowTimestamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $emailMessageData = compact('subject', 'serializedData', 'textContent', 'htmlContent', 'userId', 'ownerId', 'headers', 'attachments', 'folderId', 'nowTimestamp');
     $attachments = array('relatedModelType' => strtolower(get_class($itemOwnerModel)), 'relatedModelId' => $itemOwnerModel->id);
     $sender = static::resolveSender($marketingList, $itemOwnerModel);
     $emailMessageData = CMap::mergeArray($emailMessageData, $sender, $recipient, $attachments);
     $emailMessageId = static::saveEmailMessageWithRelated($emailMessageData);
     if (empty($emailMessageId)) {
         throw new FailedToSaveModelException();
     }
     $emailMessage = EmailMessage::getById($emailMessageId);
     return $emailMessage;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:27,代码来源:AutoresponderAndCampaignItemsEmailMessageUtil.php


示例10: testRun

 public function testRun()
 {
     //Create workflow
     $workflow = new Workflow();
     $workflow->setDescription('aDescription');
     $workflow->setIsActive(true);
     $workflow->setOrder(5);
     $workflow->setModuleClassName('WorkflowsTest2Module');
     $workflow->setName('myFirstWorkflow');
     $workflow->setTriggerOn(Workflow::TRIGGER_ON_NEW_AND_EXISTING);
     $workflow->setType(Workflow::TYPE_ON_SAVE);
     $workflow->setTriggersStructure('1');
     //Add action that is missing required owner
     $action = new ActionForWorkflowForm('WorkflowModelTestItem2', Workflow::TYPE_ON_SAVE);
     $action->type = ActionForWorkflowForm::TYPE_CREATE;
     $action->relation = 'hasMany2';
     $attributes = array('string' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 'jason'), 'lastName' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 'jason'));
     $action->setAttributes(array(ActionForWorkflowForm::ACTION_ATTRIBUTES => $attributes));
     $workflow->addAction($action);
     //Create the saved Workflow
     $savedWorkflow = new SavedWorkflow();
     SavedWorkflowToWorkflowAdapter::resolveWorkflowToSavedWorkflow($workflow, $savedWorkflow);
     $saved = $savedWorkflow->save();
     $this->assertTrue($saved);
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $job = new WorkflowValidityCheckJob();
     $this->assertTrue($job->run());
     $this->assertEquals(1, Notification::getCount());
     $this->assertEquals(1, EmailMessage::getCount());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:31,代码来源:WorkflowValidityCheckJobTest.php


示例11: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the model id.
  * @throws CHttpException if the model is not found.
  * @return EmailMessage the model.
  */
 protected function loadModel($id)
 {
     $model = EmailMessage::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('email', 'Page not found.'));
     }
     return $model;
 }
开发者ID:nordsoftware,项目名称:yii-emailer,代码行数:15,代码来源:EmailController.php


示例12: testRun

 public function testRun()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $this->assertEquals(0, EmailMessage::getCount());
     $job = new TestOutboundEmailJob();
     $this->assertTrue($job->run());
     $emailMessages = EmailMessage::getAll();
     $this->assertEquals(1, count($emailMessages));
     $this->assertEquals(EmailFolder::TYPE_SENT, $emailMessages[0]->folder->type);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:11,代码来源:TestOutboundEmailJobTest.php


示例13: 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 = '[email protected]';
     $sender->fromName = 'super';
     $sender->personsOrAccounts->add(Yii::app()->user->userModel);
     $emailMessage->sender = $sender;
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = '[email protected]';
     $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


示例14: process

 public function process($processor)
 {
     if (empty($processor->id)) {
         return;
     }
     $messages = $processor->w->Channel->getMessages($processor->channel_id);
     if (!empty($messages)) {
         foreach ($messages as $message) {
             if ($message->is_processed == 0) {
                 $rawdata = $message->getData();
                 if (!empty($rawdata)) {
                     $emailmessage = new EmailMessage($rawdata);
                     $email = $emailmessage->parse();
                     echo $email->getBodyText();
                     $message->is_processed = 1;
                     $message->update();
                 }
             }
         }
     }
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:21,代码来源:TestProcessor.php


示例15: testProcessWorkflowAfterSave

 public function testProcessWorkflowAfterSave()
 {
     $model = new WorkflowModelTestItem();
     $event = new CEvent($model);
     $observer = new WorkflowsObserver();
     $observer->setDepth(25);
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $observer->processWorkflowAfterSave($event);
     $this->assertEquals(1, Notification::getCount());
     $this->assertEquals(1, EmailMessage::getCount());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:12,代码来源:WorkflowsObserverTest.php


示例16: notifyUser

 /**
  * Notifies a user of a new comment in an article.
  *
  * @param notification The ArticleNotification object.
  * @param userInfo An UserInfo object with information about the user (we
  * mainly will need the email address!)
  * @param subject Subject of the message that will be sent to the user.
  * @param body Message that will be sent to the user.
  * @param charset the encoding that will be used in the message (it should be based
  * on the locale of the blog who is sending this message) It defaults to iso-8859-1
  * @return Returns true if the user was correctly notified or false otherwise.
  */
 function notifyUser($notification, $userInfo, $subject, $body, $charset = 'iso-8859-1')
 {
     //print( "sending notification to ".$userInfo->getEmail()."<br/>");
     $message = new EmailMessage();
     $message->setFrom($this->_config->getValue("post_notification_source_address"));
     $message->addTo($userInfo->getEmail());
     $message->setSubject("pLog Notification system");
     $message->setBody($body);
     $message->setCharset($charset);
     $service = new EmailService();
     return $service->sendMessage($message);
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:24,代码来源:articlenotifications.class.php


示例17: sendSystemEmail

 /**
  * Send system email message
  * @param string $subject
  * @param array $recipients
  * @param string $textContent
  * @param string $htmlContent
  * @throws NotSupportedException
  */
 public static function sendSystemEmail($subject, $recipients, $textContent = '', $htmlContent = '')
 {
     $emailMessage = new EmailMessage();
     $emailMessage->owner = BaseControlUserConfigUtil::getUserToRunAs();
     $emailMessage->subject = $subject;
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = $textContent;
     $emailContent->htmlContent = $htmlContent;
     $emailMessage->content = $emailContent;
     $sender = new EmailMessageSender();
     $sender->fromAddress = Yii::app()->emailHelper->resolveFromAddressByUser(Yii::app()->user->userModel);
     $sender->fromName = strval(Yii::app()->user->userModel);
     $sender->personsOrAccounts->add(Yii::app()->user->userModel);
     $emailMessage->sender = $sender;
     foreach ($recipients as $recipientEmail) {
         $recipient = new EmailMessageRecipient();
         $recipient->toAddress = $recipientEmail;
         $recipient->type = EmailMessageRecipient::TYPE_TO;
         $emailMessage->recipients->add($recipient);
     }
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     $validated = $emailMessage->validate();
     if (!$validated) {
         throw new NotSupportedException();
     }
     Yii::app()->emailHelper->sendImmediately($emailMessage);
     $saved = $emailMessage->save();
     if (!$saved) {
         throw new NotSupportedException();
     }
     if (!$emailMessage->hasSendError()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:45,代码来源:EmailMessageHelper.php


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


示例19: sendNotificationEmail

 function sendNotificationEmail($userInfo)
 {
     // if everything went fine, we can now send the confirmation email
     // only if the user specified a valid email address
     if ($userInfo->getEmail() != "") {
         // build an email message
         $message = new EmailMessage();
         $message->setBody($this->_notificationText);
         $message->setSubject("pLog Notification");
         $message->addTo($userInfo->getEmail());
         $message->setFrom($this->_userInfo->getEmail());
         // and finally send it
         $emailService = new EmailService();
         $emailService->sendMessage($message);
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:17,代码来源:adminaddbloguseraction.class.php


示例20: init

 public function init()
 {
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByTask');
         Task::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Task'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenANoteIsCreated()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByNote');
         Note::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Note'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByEmailMessage');
         EmailMessage::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['EmailMessage'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast()) {
         $eventHandler = array($this, 'resolveModelLatestActivityDateTimeProcessFlagByMeeting');
         Meeting::model()->attachEventHandler('onBeforeSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Meeting'] = array('onBeforeSave', $eventHandler);
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:23,代码来源:ContactLatestActivityDateTimeObserver.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP EmailTemplate类代码示例发布时间:2022-05-23
下一篇:
PHP EmailMarketing类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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