本文整理汇总了PHP中EmailBox类的典型用法代码示例。如果您正苦于以下问题:PHP EmailBox类的具体用法?PHP EmailBox怎么用?PHP EmailBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EmailBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 = '[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
示例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 = '[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
示例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 = '[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;
$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
示例16: makeSystemMissingBox
protected static function makeSystemMissingBox($name)
{
$box = new EmailBox();
$box->name = $name;
$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::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::getDefaultInboxName();
$folder->type = EmailFolder::TYPE_INBOX;
$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();
assert('$saved');
return $box;
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:48,代码来源:EmailBox.php
示例17: 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
示例18: 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
示例19: 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
示例20: testSendQueued
/**
* @depends testSend
*/
public function testSendQueued()
{
ZurmoConfigurationUtil::setByModuleName('SendGridModule', 'enableSendgrid', true);
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
//add a message in the outbox_error folder.
$emailMessage = SendGridTestHelper::createDraftSendGridSystemEmail('a test email 2', $super);
$box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
$emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX_ERROR);
$emailMessage->save();
$this->assertEquals(2, Yii::app()->emailHelper->getQueuedCount());
$this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
Yii::app()->emailHelper->sendQueued();
$this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
$this->assertEquals(2, Yii::app()->emailHelper->getSentCount());
//add a message in the outbox folder.
$emailMessage = SendGridTestHelper::createDraftSendGridSystemEmail('a test email 3', $super);
$box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
$emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
$emailMessage->save();
//add a message in the outbox_error folder.
$emailMessage = SendGridTestHelper::createDraftSendGridSystemEmail('a test email 4', $super);
$box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
$emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX_ERROR);
$emailMessage->save();
//add a message in the outbox_error folder.
$emailMessage = SendGridTestHelper::createDraftSendGridSystemEmail('a test email 5', $super);
$box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
$emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX_ERROR);
$emailMessage->save();
$this->assertEquals(3, Yii::app()->emailHelper->getQueuedCount());
$this->assertEquals(2, Yii::app()->emailHelper->getSentCount());
Yii::app()->emailHelper->sendQueued(1);
$this->assertEquals(2, Yii::app()->emailHelper->getQueuedCount());
$this->assertEquals(3, Yii::app()->emailHelper->getSentCount());
Yii::app()->emailHelper->sendQueued(2);
$this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
$this->assertEquals(5, Yii::app()->emailHelper->getSentCount());
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:42,代码来源:SendGridEmailHelperTest.php
注:本文中的EmailBox类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论