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


PHP EmailMessage::forget方法代码示例

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


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

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

示例2: updateEmailMessageForSending

 /**
  * Updates the email message using stored procedure
  * @param EmailMessage $emailMessage
  */
 protected function updateEmailMessageForSending(EmailMessage $emailMessage, $useSQL = false)
 {
     if (!$useSQL) {
         Yii::log("EmailMessage should have been saved by this point. Anyways, saving now", CLogger::LEVEL_INFO);
         // we save it and return. No need to call SP as the message is saved already;
         $emailMessage->save(false);
         return;
     }
     $nowTimestamp = "'" . DateTimeUtil::convertTimestampToDbFormatDateTime(time()) . "'";
     $sendAttempts = $emailMessage->sendAttempts ? $emailMessage->sendAttempts : 1;
     $sentDateTime = $emailMessage->sentDateTime ? "'" . $emailMessage->sentDateTime . "'" : 'null';
     $serializedData = $emailMessage->error->serializedData ? "'" . $emailMessage->error->serializedData . "'" : 'null';
     $sql = '`update_email_message_for_sending`(
                                                                     ' . $emailMessage->id . ',
                                                                     ' . $sendAttempts . ',
                                                                     ' . $sentDateTime . ',
                                                                     ' . $emailMessage->folder->id . ',
                                                                     ' . $serializedData . ',
                                                                     ' . $nowTimestamp . ')';
     ZurmoDatabaseCompatibilityUtil::callProcedureWithoutOuts($sql);
     $emailMessage->forget();
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:26,代码来源:EmailHelper.php


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