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

PHP EmailTemplate类代码示例

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

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



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

示例1: getViewFromEmailTemplateBuiltType

 protected static function getViewFromEmailTemplateBuiltType(EmailTemplate $emailTemplate)
 {
     if ($emailTemplate->isBuilderTemplate()) {
         return 'BuilderEmailTemplateWizardView';
     }
     return 'ClassicEmailTemplateWizardView';
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:7,代码来源:EmailTemplateWizardViewFactory.php


示例2: sendLoginDetails

 function sendLoginDetails($email)
 {
     global $sitename;
     global $logo;
     $query = MYSQL_QUERY("SELECT `Username`,`Password` FROM `ChallengeMembers` WHERE `Email` = '" . $email . "' ") or die(MYSQL_ERROR());
     if ($query) {
         if (MYSQL_NUM_ROWS($query)) {
             while ($row = MYSQL_FETCH_ARRAY($query)) {
                 $userpassword = $row['Password'];
                 $username = $row['Username'];
             }
             /*send email*/
             include 'email_class.php';
             $em = new EmailTemplate();
             $subject = ucfirst($sitename) . " Login Details";
             $headers = "From: " . ucwords($sitename) . " <[email protected]> \r\n" . 'X-Mailer: PHP/' . phpversion();
             $headers .= 'MIME-Version: 1.0' . "\r\n";
             $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
             $email_message = $username . ",<br /><br /> Thank you for your interest in joining our challenges.\n\t\t\t\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t\t\t\tThe following are your login data:\n\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\tUsername : <b>" . $username . "</b><br />\n\t\t\t\t\t\t\t\t\tPassword : <b>" . $userpassword . "</b>\n\t\t\t\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t\t\t\tThank you.<br />\n\t\t\t\t\t\t\t\t\t<b>" . $sitename . "</b>";
             $emailmessage = $em->get($logo, $sitename, $email_message);
             /*first send to guest */
             $sentmail = mail($email, $subject, $emailmessage, $headers);
             /*end of send email*/
             return "OK";
         } else {
             return $email . "not found in database.";
         }
     } else {
         return "Email not found in database.";
     }
 }
开发者ID:AleemDev,项目名称:OpenSource,代码行数:31,代码来源:login_function.php


示例3: save

 function save($check_notify = false)
 {
     global $current_user, $sugar_config;
     parent::save($check_notify);
     $email_template = new EmailTemplate();
     if ($_REQUEST['module'] == 'Import') {
         //Don't send email on import
         return;
     }
     $signature = array();
     $addDelimiter = true;
     $aop_config = $sugar_config['aop'];
     if (!empty($this->contact_id)) {
         $emails = $this->getEmailForUser();
         if ($aop_config['user_email_template_id']) {
             $email_template->retrieve($aop_config['user_email_template_id']);
         }
         $addDelimiter = false;
     } elseif ($this->assigned_user_id && !$this->internal) {
         $emails = $this->getEmailForContact();
         if ($aop_config['contact_email_template_id']) {
             $email_template->retrieve($aop_config['contact_email_template_id']);
             $signature = $current_user->getDefaultSignature();
         }
     }
     if ($emails && $email_template) {
         $GLOBALS['log']->info("AOPCaseUpdates: Calling send email");
         $res = $this->sendEmail($emails, $email_template, $signature, $this->case_id, $addDelimiter);
     }
 }
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:30,代码来源:AOP_Case_Updates.php


示例4: canSendPassword

function canSendPassword()
{
    global $mod_strings, $current_user, $app_strings;
    require_once "modules/OutboundEmailConfiguration/OutboundEmailConfigurationPeer.php";
    if ($current_user->is_admin) {
        $emailTemplate = new EmailTemplate();
        $emailTemplate->disable_row_level_security = true;
        if ($emailTemplate->retrieve($GLOBALS['sugar_config']['passwordsetting']['generatepasswordtmpl']) == '') {
            return $mod_strings['LBL_EMAIL_TEMPLATE_MISSING'];
        }
        if (empty($emailTemplate->body) && empty($emailTemplate->body_html)) {
            return $app_strings['LBL_EMAIL_TEMPLATE_EDIT_PLAIN_TEXT'];
        }
        if (!OutboundEmailConfigurationPeer::validSystemMailConfigurationExists($current_user)) {
            return $mod_strings['ERR_SERVER_SMTP_EMPTY'];
        }
        $emailErrors = $mod_strings['ERR_EMAIL_NOT_SENT_ADMIN'];
        try {
            $config = OutboundEmailConfigurationPeer::getSystemDefaultMailConfiguration();
            if ($config instanceof OutboundSmtpEmailConfiguration) {
                $emailErrors .= "<br>-{$mod_strings['ERR_SMTP_URL_SMTP_PORT']}";
                if ($config->isAuthenticationRequired()) {
                    $emailErrors .= "<br>-{$mod_strings['ERR_SMTP_USERNAME_SMTP_PASSWORD']}";
                }
            }
        } catch (MailerException $me) {
            // might want to report the error
        }
        $emailErrors .= "<br>-{$mod_strings['ERR_RECIPIENT_EMAIL']}";
        $emailErrors .= "<br>-{$mod_strings['ERR_SERVER_STATUS']}";
        return $emailErrors;
    }
    return $mod_strings['LBL_EMAIL_NOT_SENT'];
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:34,代码来源:password_utils.php


示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = User::getByUsername('super');
     $super = User::getByUsername('super');
     $super->primaryEmail = new Email();
     $super->primaryEmail->emailAddress = '[email protected]';
     assert($super->save());
     // Not Coding Standard
     $bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
     $sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
     self::$superUserId = $super->id;
     self::$bobbyUserId = $bobby->id;
     self::$sarahUserId = $sarah->id;
     $emailTemplate = new EmailTemplate();
     $emailTemplate->modelClassName = 'WorkflowModelTestItem';
     $emailTemplate->type = 1;
     $emailTemplate->name = 'some template';
     $emailTemplate->subject = 'some subject [[LAST^NAME]]';
     $emailTemplate->htmlContent = 'html content [[STRING]]';
     $emailTemplate->textContent = 'text content [[PHONE]]';
     $saved = $emailTemplate->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     self::$emailTemplate = $emailTemplate;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:27,代码来源:WorkflowEmailMessageProcessingHelperTest.php


示例6: canSendPassword

function canSendPassword()
{
    require_once 'include/SugarPHPMailer.php';
    global $mod_strings;
    global $current_user;
    global $app_strings;
    $mail = new SugarPHPMailer();
    $emailTemp = new EmailTemplate();
    $mail->setMailerForSystem();
    $emailTemp->disable_row_level_security = true;
    if ($current_user->is_admin) {
        if ($emailTemp->retrieve($GLOBALS['sugar_config']['passwordsetting']['generatepasswordtmpl']) == '') {
            return $mod_strings['LBL_EMAIL_TEMPLATE_MISSING'];
        }
        if (empty($emailTemp->body) && empty($emailTemp->body_html)) {
            return $app_strings['LBL_EMAIL_TEMPLATE_EDIT_PLAIN_TEXT'];
        }
        if ($mail->Mailer == 'smtp' && $mail->Host == '') {
            return $mod_strings['ERR_SERVER_SMTP_EMPTY'];
        }
        $email_errors = $mod_strings['ERR_EMAIL_NOT_SENT_ADMIN'];
        if ($mail->Mailer == 'smtp') {
            $email_errors .= "<br>-" . $mod_strings['ERR_SMTP_URL_SMTP_PORT'];
        }
        if ($mail->SMTPAuth) {
            $email_errors .= "<br>-" . $mod_strings['ERR_SMTP_USERNAME_SMTP_PASSWORD'];
        }
        $email_errors .= "<br>-" . $mod_strings['ERR_RECIPIENT_EMAIL'];
        $email_errors .= "<br>-" . $mod_strings['ERR_SERVER_STATUS'];
        return $email_errors;
    } else {
        return $mod_strings['LBL_EMAIL_NOT_SENT'];
    }
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:34,代码来源:password_utils.php


示例7: testCleanBean

 /**
  * Test asserts that body_html has variables after cleanBean call
  *
  * @group 60152
  * @dataProvider dataProvider
  * @return void
  */
 public function testCleanBean($html, $needle)
 {
     $bean = new EmailTemplate();
     $bean->body_html = $html;
     $bean->cleanBean();
     $this->assertContains($needle, $bean->body_html);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:14,代码来源:Bug60152Test.php


示例8: testXssFilterBean

 /**
  * @dataProvider xssData
  */
 public function testXssFilterBean($before, $after)
 {
     $bean = new EmailTemplate();
     $bean->body_html = to_html($before);
     $bean->cleanBean();
     $this->assertEquals(to_html($after), $bean->body_html);
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:10,代码来源:XssTest.php


示例9: forgotPasswordMail

 function forgotPasswordMail($argArrPOST)
 {
     $objTemplate = new EmailTemplate();
     $objValid = new Validate_fields();
     $objCore = new Core();
     $objGeneral = new General();
     $objValid->check_4html = true;
     $_SESSION['sessForgotValues'] = array();
     $objValid->add_text_field('Login ID', strip_tags($argArrPOST['frmUserName']), 'text', 'y', 255);
     $objValid->add_text_field('Verification Code', strip_tags($argArrPOST['frmSecurityCode']), 'text', 'y', 255);
     if (!$objValid->validation()) {
         $errorMsg = $objValid->create_msg();
     }
     if ($errorMsg) {
         $_SESSION['sessForgotValues'] = $argArrPOST;
         $objCore->setErrorMsg($errorMsg);
         return false;
     } else {
         if ($_SESSION['security_code'] == $argArrPOST['frmSecurityCode'] && !empty($_SESSION['security_code'])) {
             $varWhereCond = " AND ClientEmailAddress  ='" . $argArrPOST['frmUserName'] . "'";
             $userRecords = $this->getClientNumRows($varWhereCond);
             $userInfo = $this->getClientInfo($varWhereCond);
             if ($userRecords > 0) {
                 $varClientID = $userInfo['0']['pkClientID'];
                 $varMemberData = trim(strip_tags($argArrPOST['frmUserName']));
                 $varForgotPasswordCode = $objGeneral->getValidRandomKey(TABLE_CLIENTS, array('pkClientID'), 'ClientForgotPWCode', '25');
                 $varForgotPasswordLink = '<a href="' . SITE_ROOT_URL . 'clients/reset_password.php?mid=' . $varClientID . '&code=' . $varForgotPasswordCode . '">' . SITE_ROOT_URL . 'clients/reset_password.php?mid=' . $varClientID . '&code=' . $varForgotPasswordCode . '</a>';
                 $arrColumns = array('ClientForgotPWStatus' => 'Active', 'ClientForgotPWCode' => $varForgotPasswordCode);
                 $varWhereCondition = 'pkClientID = \'' . $varClientID . '\'';
                 $this->update(TABLE_CLIENTS, $arrColumns, $varWhereCondition);
                 $varClientEmail = $userInfo[0]['ClientEmailAddress'];
                 $varToUser = $varClientEmail;
                 $varFromUser = SITE_NAME . '<' . $varClientEmail . '>';
                 $varSiteName = SITE_NAME;
                 $varWhereTemplate = ' EmailTemplateTitle= \'Forgot password\' AND EmailTemplateStatus = \'Active\' ';
                 $arrMailTemplate = $objTemplate->getTemplateInfo($varWhereTemplate);
                 $varOutput = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateDescription']));
                 $varSubject = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateSubject']));
                 $varSubject = str_replace('{PROJECT_NAME}', SITE_NAME, html_entity_decode(stripcslashes($arrMailTemplate['0']['EmailTemplateSubject'])));
                 $varKeyword = array('{IMAGE_PATH}', '{MEMBER}', '{PROJECT_NAME}', '{USER_DATA}', '{FORGOT_PWD_LINK}', '{SITE_NAME}');
                 $varKeywordValues = array($varPathImage, 'Client', SITE_NAME, $varMemberData, $varForgotPasswordLink, SITE_NAME);
                 $varOutPutValues = str_replace($varKeyword, $varKeywordValues, $varOutput);
                 $objCore->sendMail($varToUser, $varFromUser, $varSubject, $varOutPutValues);
                 $_SESSION['sessForgotValues'] = '';
                 $objCore->setSuccessMsg(ADMIN_FORGOT_PASSWORD_CONFIRM_MSG);
                 return true;
             } else {
                 $_SESSION['sessForgotValues'] = $argArrPOST;
                 $objCore->setErrorMsg(EMAIL_NOT_EXIST_MSG);
                 return true;
             }
         } else {
             $_SESSION['sessForgotValues'] = $argArrPOST;
             $objCore->setErrorMsg(INVALID_SECURITY_CODE_MSG);
             return false;
         }
     }
 }
开发者ID:saurabhs4,项目名称:niches,代码行数:58,代码来源:class.clients_login.php


示例10: testAssignedUserName

 public function testAssignedUserName()
 {
     global $locale;
     require_once 'include/Localization/Localization.php';
     $locale = new Localization();
     $testName = $locale->getLocaleFormattedName($this->user->first_name, $this->user->last_name);
     $testTemplate = new EmailTemplate();
     $testTemplate->retrieve($this->emailTemplate->id);
     $this->assertEquals($testName, $testTemplate->assigned_user_name, 'Assert that the assigned_user_name is the locale formatted name value');
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:10,代码来源:Bug48800Test.php


示例11: testParseTrackerUrl

 /**
  * Testing EmailTemplate::parse_tracker_urls
  * @group 46984
  * @dataProvider templatesProvider
  */
 public function testParseTrackerUrl($data, $expects, $result)
 {
     $et = new EmailTemplate();
     $res = $et->parse_tracker_urls($data[0], $data[1], $data[2], $data[3]);
     if ($result) {
         $this->assertEquals($expects, $res);
     } else {
         $this->assertNotEquals($expects, $res);
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:15,代码来源:Bug46984Test.php


示例12: testRun

 /**
  * Test sending an email that should go out as a processing that this job would typically do.
  * Also tests that item does not get trashed when deleting the WorkflowMessageInQueue.
  * Also tests that if there is more than one emailmessage against the workflow, that it does not send
  * to all of them
  * @depends testWorkflowMessageInQueueProperlySavesWithoutTrashingRelatedModelItem
  */
 public function testRun()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $emailTemplate = new EmailTemplate();
     $emailTemplate->builtType = EmailTemplate::BUILT_TYPE_PASTED_HTML;
     $emailTemplate->name = 'the name';
     $emailTemplate->modelClassName = 'Account';
     $emailTemplate->type = 2;
     $emailTemplate->subject = 'subject';
     $emailTemplate->textContent = 'sample text content';
     $saved = $emailTemplate->save();
     $this->assertTrue($saved);
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $model = ContactTestHelper::createContactByNameForOwner('Jason', Yii::app()->user->userModel);
     $model->primaryEmail->emailAddress = '[email protected]';
     $saved = $model->save();
     $this->assertTrue($saved);
     $modelId = $model->id;
     $model->forget();
     $model = Contact::getById($modelId);
     $trigger = array('attributeIndexOrDerivedType' => 'firstName', 'operator' => OperatorRules::TYPE_EQUALS, 'durationInterval' => '333');
     $actions = array(array('type' => ActionForWorkflowForm::TYPE_UPDATE_SELF, ActionForWorkflowForm::ACTION_ATTRIBUTES => array('description' => array('shouldSetValue' => '1', 'type' => WorkflowActionAttributeForm::TYPE_STATIC, 'value' => 'some new description'))));
     $emailMessages = array();
     $emailMessages[0]['emailTemplateId'] = $emailTemplate->id;
     $emailMessages[0]['sendFromType'] = EmailMessageForWorkflowForm::SEND_FROM_TYPE_DEFAULT;
     $emailMessages[0]['sendAfterDurationSeconds'] = '0';
     $emailMessages[0][EmailMessageForWorkflowForm::EMAIL_MESSAGE_RECIPIENTS] = array(array('type' => WorkflowEmailMessageRecipientForm::TYPE_DYNAMIC_TRIGGERED_MODEL, 'audienceType' => EmailMessageRecipient::TYPE_TO));
     $emailMessages[1]['emailTemplateId'] = $emailTemplate->id;
     $emailMessages[1]['sendFromType'] = EmailMessageForWorkflowForm::SEND_FROM_TYPE_DEFAULT;
     $emailMessages[1]['sendAfterDurationSeconds'] = '10000';
     $emailMessages[1][EmailMessageForWorkflowForm::EMAIL_MESSAGE_RECIPIENTS] = array(array('type' => WorkflowEmailMessageRecipientForm::TYPE_DYNAMIC_TRIGGERED_MODEL, 'audienceType' => EmailMessageRecipient::TYPE_TO));
     $savedWorkflow = new SavedWorkflow();
     $savedWorkflow->name = 'some workflow';
     $savedWorkflow->description = 'description';
     $savedWorkflow->moduleClassName = 'ContactsModule';
     $savedWorkflow->triggerOn = Workflow::TRIGGER_ON_NEW_AND_EXISTING;
     $savedWorkflow->type = Workflow::TYPE_ON_SAVE;
     $data[ComponentForWorkflowForm::TYPE_TRIGGERS] = array($trigger);
     $data[ComponentForWorkflowForm::TYPE_ACTIONS] = $actions;
     $data[ComponentForWorkflowForm::TYPE_EMAIL_MESSAGES] = $emailMessages;
     $savedWorkflow->serializedData = serialize($data);
     $savedWorkflow->isActive = true;
     $saved = $savedWorkflow->save();
     $this->assertTrue($saved);
     WorkflowTestHelper::createExpiredWorkflowMessageInQueue($model, $savedWorkflow, serialize(array($emailMessages[1])));
     RedBeanModelsCache::forgetAll(true);
     //simulates page change, required to confirm Item does not get trashed
     $this->assertEquals(1, WorkflowMessageInQueue::getCount());
     $job = new WorkflowMessageInQueueJob();
     $this->assertTrue($job->run());
     $this->assertEquals(0, WorkflowMessageInQueue::getCount());
     RedBeanModelsCache::forgetAll(true);
     //simulates page change, required to confirm Item does not get trashed
     $this->assertEquals(1, Yii::app()->emailHelper->getQueuedCount());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:62,代码来源:WorkflowMessageInQueueJobTest.php


示例13: search

 public function search()
 {
     $emailTemplate = new EmailTemplate('search');
     $emailTemplate->name = 'the name changed';
     $dataProvider = $emailTemplate->search();
     $data = $dataProvider->getData();
     $this->assertEquals($data[0]->name, 'the name changed');
     $this->assertEquals($data[0]->subject, 'the subject changed');
     $this->assertEquals($data[0]->heading, 'the heading changed');
     $this->assertEquals($data[0]->message, 'the message changed');
 }
开发者ID:Khan143,项目名称:yii-email-module,代码行数:11,代码来源:EmailTemplateTest.php


示例14: actionCreate

 /**
  * Create
  */
 public function actionCreate()
 {
     $emailTemplate = new EmailTemplate('create');
     if (isset($_POST['EmailTemplate'])) {
         $emailTemplate->attributes = $_POST['EmailTemplate'];
         if ($emailTemplate->save()) {
             $this->redirect(array('template/view', 'id' => $emailTemplate->id));
         }
     }
     $this->render('create', array('emailTemplate' => $emailTemplate));
 }
开发者ID:Khan143,项目名称:yii-email-module,代码行数:14,代码来源:EmailTemplateController.php


示例15: sendemailVerification

 function sendemailVerification($username, $email, $verification_code)
 {
     global $sitename;
     global $logo;
     include 'email_class.php';
     $em = new EmailTemplate();
     $subject = ucfirst($sitename) . " Registration";
     $headers = "From: " . ucwords($sitename) . " <[email protected]> \r\n" . 'X-Mailer: PHP/' . phpversion();
     $headers .= 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
     $email_message = $username . ",<br /><br /> Thank you for your interest in joining our challenges.\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\tTo verify your account, please click <a href='http://" . $sitename . "/verify.html?code=" . $verification_code . "'>here</a>.\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t<b>" . $sitename . "</b>";
     $emailmessage = $em->get($logo, $sitename, $email_message);
     /*first send to guest */
     $sentmail = mail($email, $subject, $emailmessage, $headers);
 }
开发者ID:AleemDev,项目名称:OpenSource,代码行数:15,代码来源:register_function.php


示例16: postInsert

 public function postInsert($event)
 {
     // send message to ticket creator and observers
     if (!$this->getSkipNotification()) {
         // to creator
         if ($this->getCreatedBy() != $this->getTicket()->getCreatedBy()) {
             $to = $this->getTicket()->getRealSender() ?: $this->getTicket()->getCreator()->getEmailAddress();
             Email::send($to, Email::generateSubject($this->getTicket()), EmailTemplate::newComment($this));
         }
         // to observers and responsibles
         $usersToNotify = $this->getTicket()->getResponsiblesAndObserversForNotification();
         foreach ($usersToNotify as $user) {
             if ($user->getId() != $this->getCreatedBy() and $user->getId() != $this->getTicket()->getCreatedBy()) {
                 Email::send($user->getEmailAddress(), Email::generateSubject($this->getTicket()), EmailTemplate::newComment($this));
             }
         }
     }
     // send messages to mentioned users
     $mentions = Helpdesk::findMentions($this->getText());
     foreach ($mentions as $mention) {
         if ($mention->getId() != $this->getCreatedBy() and $mention->getId() != $this->getTicket()->getCreatedBy()) {
             Email::send($mention->getEmailAddress(), Email::generateSubject($this->getTicket()), EmailTemplate::newComment($this, 'mention'));
             $observingAlready = Doctrine_Query::create()->from('RefTicketObserver ref')->addWhere('ref.user_id = ?', $mention->getId())->addWhere('ref.ticket_id = ?', $this->getTicket()->getId())->count() !== 0;
             $isResponsible = Doctrine_Query::create()->from('RefTicketResponsible ref')->addWhere('ref.user_id = ?', $mention->getId())->addWhere('ref.ticket_id = ?', $this->getTicket()->getId())->count() !== 0;
             if (!$observingAlready and !$isResponsible) {
                 $observeRecord = RefTicketObserver::createFromArray(['user_id' => $mention->getId(), 'ticket_id' => $this->getTicket()->getId()]);
                 // workaround for mentions in comments created from email
                 if (!sfContext::getInstance()->getUser()->getGuardUser()) {
                     $observeRecord->setCreatedBy($this->getCreatedBy());
                 }
                 $observeRecord->save();
             }
         }
     }
 }
开发者ID:vik0803,项目名称:helpdesk,代码行数:35,代码来源:Comment.class.php


示例17: actionCheckPostponedOrders

 /**
  * Check for orders without carrier chosen
  *
  * @return int
  */
 public function actionCheckPostponedOrders()
 {
     echo "Finding postponed orders..." . PHP_EOL;
     /** @var Order[] $orders */
     $orders = Order::model()->getPostponedOrders();
     $ordersCount = count($orders);
     Yii::log(sprintf("Found %s delayed %s" . PHP_EOL, $ordersCount, $this->pluralize('order', $ordersCount)), CLogger::LEVEL_ERROR, 'email_notification');
     foreach ($orders as $order) {
         Yii::log(sprintf("Sending notification email about postponed Order #%s to User #%s %s <%s>", $order->id, $order->creator_id, $order->creator->fullname, $order->creator->email), CLogger::LEVEL_INFO, 'email_notification');
         /** @var SwiftMailer $mailer */
         $mailer = Yii::app()->mailer;
         /** @var EmailTemplate $emailTemplateModel */
         $emailTemplateModel = EmailTemplate::model();
         $template = $emailTemplateModel->getEmailTemplateBySlug(EmailTemplate::TEMPLATE_ORDER_DELAYED);
         $replacements = [$order->creator->email => ['{{order}}' => CHtml::link('#' . $order->id, Yii::app()->createAbsoluteUrl('order/view', ['id' => $order->id]))]];
         if ($template) {
             $mailer->setSubject($template->subject)->setBody($template->body)->setTo($order->creator->email)->setDecoratorReplacements($replacements)->send();
         } else {
             Yii::log("Email template not found!", CLogger::LEVEL_ERROR, 'email_notification');
             return 1;
         }
     }
     echo "Done!" . PHP_EOL;
     return 0;
 }
开发者ID:septembermd,项目名称:n1,代码行数:30,代码来源:OrderCommand.php


示例18: postInsert

 public function postInsert($event)
 {
     $company = $this->getCreator()->getGroups()->getFirst();
     // notify it-admins
     if ($company) {
         $subject = Email::generateSubject($this);
         $text = 'Заявка от компании ' . $company->getName() . ', пользователь ' . $this->getCreator()->getUsername() . PHP_EOL . 'http://helpdesk.f1lab.ru/tickets/' . $this->getId();
         // sms
         if (true == ($notify = $company->getNotifySms())) {
             $phones = [];
             foreach ($notify as $user) {
                 if ($user->getPhone()) {
                     $phones[] = $user->getPhone();
                 }
             }
             Sms::send($phones, $text);
         }
         // email
         if (true == ($notify = $company->getNotifyEmail())) {
             $emails = [];
             foreach ($notify as $user) {
                 if ($user->getEmailAddress()) {
                     $emails[] = $user->getEmailAddress();
                 }
             }
             Email::send($emails, $subject, $text);
         }
     }
     // send email to creator
     $to = $this->getRealSender() ?: $this->getCreator()->getEmailAddress();
     Email::send($to, Email::generateSubject($this), EmailTemplate::newTicket($this));
 }
开发者ID:vik0803,项目名称:helpdesk,代码行数:32,代码来源:Ticket.class.php


示例19: makeBuilderPredefinedEmailTemplate

 protected function makeBuilderPredefinedEmailTemplate($name, $unserializedData, $subject = null, $modelClassName = null, $language = null, $type = null, $isDraft = 0, $textContent = null, $htmlContent = null)
 {
     $emailTemplate = new EmailTemplate();
     $emailTemplate->type = $type;
     //EmailTemplate::TYPE_WORKFLOW;
     $emailTemplate->builtType = EmailTemplate::BUILT_TYPE_BUILDER_TEMPLATE;
     $emailTemplate->isDraft = $isDraft;
     $emailTemplate->modelClassName = $modelClassName;
     $emailTemplate->name = $name;
     if (empty($subject)) {
         $subject = $name;
     }
     $emailTemplate->subject = $subject;
     if (!isset($language)) {
         $language = Yii::app()->languageHelper->getForCurrentUser();
     }
     $emailTemplate->language = $language;
     $emailTemplate->htmlContent = $htmlContent;
     $emailTemplate->textContent = $textContent;
     $emailTemplate->serializedData = CJSON::encode($unserializedData);
     $emailTemplate->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
     $saved = $emailTemplate->save(false);
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     $emailTemplate = EmailTemplate::getById($emailTemplate->id);
     ReadPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($emailTemplate, Group::getByName(Group::EVERYONE_GROUP_NAME));
     $saved = $emailTemplate->save(false);
     assert('$saved');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:30,代码来源:EmailTemplatesBaseDefaultDataMaker.php


示例20: setUncommonAttributes

 /**
  * @param EmailTemplateWizardForm $formModel
  */
 protected function setUncommonAttributes(EmailTemplateWizardForm $formModel)
 {
     // handle any custom mappings between EmailTemplateWizardForm and EmailTemplate model here.
     if ($this->emailTemplate->isBuilderTemplate()) {
         $unserializedData = CJSON::decode($this->emailTemplate->serializedData);
         $formModel->baseTemplateId = $unserializedData['baseTemplateId'];
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:11,代码来源:EmailTemplateToWizardFormAdapter.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP EmailUI类代码示例发布时间:2022-05-23
下一篇:
PHP EmailMessage类代码示例发布时间: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