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


PHP EmailTemplate类代码示例

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


在下文中一共展示了EmailTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) . " <admin@domaindirectory.com> \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 = 'super@zurmo.com';
     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 = 'jason@zurmoland.com';
     $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) . " <admin@domaindirectory.com> \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


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