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


PHP eZMail::setContentType方法代码示例

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


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

示例1: sendOrderEmail

 function sendOrderEmail($params)
 {
     $ini = eZINI::instance();
     if (isset($params['order']) and isset($params['email'])) {
         $order = $params['order'];
         $email = $params['email'];
         $tpl = eZTemplate::factory();
         $tpl->setVariable('order', $order);
         $templateResult = $tpl->fetch('design:shop/orderemail.tpl');
         $subject = $tpl->variable('subject');
         $mail = new eZMail();
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if (!$emailSender) {
             $emailSender = $ini->variable("MailSettings", "AdminEmail");
         }
         if ($tpl->hasVariable('content_type')) {
             $mail->setContentType($tpl->variable('content_type'));
         }
         $mail->setReceiver($email);
         $mail->setSender($emailSender);
         $mail->setSubject($subject);
         $mail->setBody($templateResult);
         $mailResult = eZMailTransport::send($mail);
         $email = $ini->variable('MailSettings', 'AdminEmail');
         $mail = new eZMail();
         if ($tpl->hasVariable('content_type')) {
             $mail->setContentType($tpl->variable('content_type'));
         }
         $mail->setReceiver($email);
         $mail->setSender($emailSender);
         $mail->setSubject($subject);
         $mail->setBody($templateResult);
         $mailResult = eZMailTransport::send($mail);
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:35,代码来源:ezdefaultconfirmorderhandler.php

示例2: eZMail

            $receiver = $email;

            $mail = new eZMail();
            if ( !$mail->validate( $receiver ) )
            {
            }

            $tpl = eZTemplate::factory();
            $tpl->setVariable( 'user', $userToSendEmail );
            $tpl->setVariable( 'object', $userToSendEmail->attribute( 'contentobject' ) );
            $tpl->setVariable( 'password', $password );
            $tpl->setVariable( 'link', true );
            $tpl->setVariable( 'hash_key', $hashKey );
            $templateResult = $tpl->fetch( 'design:user/forgotpasswordmail.tpl' );
            if ( $tpl->hasVariable( 'content_type' ) )
                $mail->setContentType( $tpl->variable( 'content_type' ) );
            $emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
            if ( !$emailSender )
                $emailSender = $ini->variable( 'MailSettings', 'AdminEmail' );
            $mail->setSender( $emailSender );
            $mail->setReceiver( $receiver );
            $subject = ezpI18n::tr( 'kernel/user/register', 'Registration info' );
            if ( $tpl->hasVariable( 'subject' ) )
                $subject = $tpl->variable( 'subject' );
            $mail->setSubject( $subject );
            $mail->setBody( $templateResult );
            $mailResult = eZMailTransport::send( $mail );
            $tpl->setVariable( 'email', $email );

        }
        else
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:31,代码来源:forgotpassword.php

示例3: sendUserNotification

 /**
  *  Send the notification after registeration
  */
 public static function sendUserNotification($userID)
 {
     eZDebugSetting::writeNotice('Sending approval notification to the user.', 'kernel-user', 'user register');
     $user = eZUser::fetch($userID);
     $ini = eZINI::instance();
     // Send mail
     $tpl = eZTemplate::factory();
     $tpl->setVariable('user', $user);
     $templateResult = $tpl->fetch('design:user/registrationapproved.tpl');
     $mail = new eZMail();
     if ($tpl->hasVariable('content_type')) {
         $mail->setContentType($tpl->variable('content_type'));
     }
     $emailSender = $ini->variable('MailSettings', 'EmailSender');
     if ($tpl->hasVariable('email_sender')) {
         $emailSender = $tpl->variable('email_sender');
     } else {
         if (!$emailSender) {
             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
         }
     }
     if ($tpl->hasVariable('subject')) {
         $subject = $tpl->variable('subject');
     } else {
         $subject = ezpI18n::tr('kernel/user/register', 'User registration approved');
     }
     $mail->setSender($emailSender);
     $receiver = $user->attribute('email');
     $mail->setReceiver($receiver);
     $mail->setSubject($subject);
     $mail->setBody($templateResult);
     $mailResult = eZMailTransport::send($mail);
     return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:37,代码来源:ezuseroperationcollection.php

示例4: checkContentActions

 function checkContentActions($module, $class, $object, $version, $contentObjectAttributes, $EditVersion, $EditLanguage)
 {
     if ($module->isCurrentAction('Cancel')) {
         $http = eZHTTPTool::instance();
         if ($http->hasPostVariable('RedirectIfDiscarded')) {
             eZRedirectManager::redirectTo($module, $http->postVariable('RedirectIfDiscarded'));
         } else {
             eZRedirectManager::redirectTo($module, '/');
         }
         $version->removeThis();
         $http = eZHTTPTool::instance();
         $http->removeSessionVariable("RegisterUserID");
         $http->removeSessionVariable('StartedRegistration');
         return eZModule::HOOK_STATUS_CANCEL_RUN;
     }
     if ($module->isCurrentAction('Publish')) {
         $userID = $object->attribute('id');
         $operationResult = eZOperationHandler::execute('user', 'register', array('user_id' => $userID));
         // send feedback
         $ini = eZINI::instance();
         $tpl = eZTemplate::factory();
         $hostname = eZSys::hostname();
         $user = eZUser::fetch($userID);
         $feedbackTypes = $ini->variableArray('UserSettings', 'RegistrationFeedback');
         foreach ($feedbackTypes as $feedbackType) {
             switch ($feedbackType) {
                 case 'email':
                     // send feedback with the default email type
                     $mail = new eZMail();
                     $tpl->resetVariables();
                     $tpl->setVariable('user', $user);
                     $tpl->setVariable('object', $object);
                     $tpl->setVariable('hostname', $hostname);
                     $templateResult = $tpl->fetch('design:user/registrationfeedback.tpl');
                     if ($tpl->hasVariable('content_type')) {
                         $mail->setContentType($tpl->variable('content_type'));
                     }
                     $emailSender = $ini->variable('MailSettings', 'EmailSender');
                     if ($tpl->hasVariable('email_sender')) {
                         $emailSender = $tpl->variable('email_sender');
                     } else {
                         if (!$emailSender) {
                             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
                         }
                     }
                     $feedbackReceiver = $ini->variable('UserSettings', 'RegistrationEmail');
                     if ($tpl->hasVariable('email_receiver')) {
                         $feedbackReceiver = $tpl->variable('email_receiver');
                     } else {
                         if (!$feedbackReceiver) {
                             $feedbackReceiver = $ini->variable('MailSettings', 'AdminEmail');
                         }
                     }
                     if ($tpl->hasVariable('subject')) {
                         $subject = $tpl->variable('subject');
                     } else {
                         $subject = ezpI18n::tr('kernel/user/register', 'New user registered');
                     }
                     $mail->setSender($emailSender);
                     $mail->setReceiver($feedbackReceiver);
                     $mail->setSubject($subject);
                     $mail->setBody($templateResult);
                     $mailResult = eZMailTransport::send($mail);
                     break;
                 default:
                     $registrationFeedbackClass = false;
                     // load custom registration feedback settings
                     if ($ini->hasGroup('RegistrationFeedback_' . $feedbackType)) {
                         if ($ini->hasVariable('RegistrationFeedback_' . $feedbackType, 'File')) {
                             include_once $ini->variable('RegistrationFeedback_' . $feedbackType, 'File');
                         }
                         $registrationFeedbackClass = $ini->variable('RegistrationFeedback_' . $feedbackType, 'Class');
                     }
                     // try to call the registration feedback class with function registrationFeedback
                     if ($registrationFeedbackClass && method_exists($registrationFeedbackClass, 'registrationFeedback')) {
                         call_user_func(array($registrationFeedbackClass, 'registrationFeedback'), $user, $tpl, $object, $hostname);
                     } else {
                         eZDebug::writeWarning("Unknown feedback type '{$feedbackType}'", 'user/register');
                     }
             }
         }
         $http = eZHTTPTool::instance();
         $http->removeSessionVariable("GeneratedPassword");
         $http->removeSessionVariable("RegisterUserID");
         $http->removeSessionVariable('StartedRegistration');
         // if everything is passed, login the user
         if ($operationResult['status'] === eZModuleOperationInfo::STATUS_CONTINUE) {
             $user->loginCurrent();
         }
         // check for redirectionvariable
         if ($operationResult['status'] === eZModuleOperationInfo::STATUS_CONTINUE || $operationResult['status'] === eZModuleOperationInfo::STATUS_HALTED) {
             if ($http->hasSessionVariable('RedirectAfterUserRegister')) {
                 $module->redirectTo($http->sessionVariable('RedirectAfterUserRegister'));
                 $http->removeSessionVariable('RedirectAfterUserRegister');
             } else {
                 if ($http->hasPostVariable('RedirectAfterUserRegister')) {
                     $module->redirectTo($http->postVariable('RedirectAfterUserRegister'));
                 } else {
                     $module->redirectTo('/user/success/');
                 }
//.........这里部分代码省略.........
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:101,代码来源:register.php

示例5: processUserActivation

 /**
  * Processes user activation
  *
  * @param eZUser $user
  * @param string $password
  */
 public static function processUserActivation($user, $password)
 {
     $ini = eZINI::instance();
     $tpl = eZTemplate::factory();
     $tpl->setVariable('user', $user);
     $tpl->setVariable('object', $user->contentObject());
     $tpl->setVariable('hostname', eZSys::hostname());
     $tpl->setVariable('password', $password);
     // Check whether account activation is required.
     $verifyUserType = $ini->variable('UserSettings', 'VerifyUserType');
     $sendUserMail = !!$verifyUserType;
     // For compatibility with old setting
     if ($verifyUserType === 'email' && $ini->hasVariable('UserSettings', 'VerifyUserEmail') && $ini->variable('UserSettings', 'VerifyUserEmail') !== 'enabled') {
         $verifyUserType = false;
     }
     if ($verifyUserType === 'email') {
         // Disable user account and send verification mail to the user
         $userID = $user->attribute('contentobject_id');
         // Create enable account hash and send it to the newly registered user
         $hash = md5(mt_rand() . time() . $userID);
         if (eZOperationHandler::operationIsAvailable('user_activation')) {
             eZOperationHandler::execute('user', 'activation', array('user_id' => $userID, 'user_hash' => $hash, 'is_enabled' => false));
         } else {
             eZUserOperationCollection::activation($userID, $hash, false);
         }
         // Log out current user
         eZUser::logoutCurrent();
         $tpl->setVariable('hash', $hash);
         $sendUserMail = true;
     } else {
         if ($verifyUserType) {
             $verifyUserTypeClass = false;
             // load custom verify user settings
             if ($ini->hasGroup('VerifyUserType_' . $verifyUserType)) {
                 if ($ini->hasVariable('VerifyUserType_' . $verifyUserType, 'File')) {
                     include_once $ini->variable('VerifyUserType_' . $verifyUserType, 'File');
                 }
                 $verifyUserTypeClass = $ini->variable('VerifyUserType_' . $verifyUserType, 'Class');
             }
             // try to call the verify user class with function verifyUser
             if ($verifyUserTypeClass && method_exists($verifyUserTypeClass, 'verifyUser')) {
                 $sendUserMail = call_user_func(array($verifyUserTypeClass, 'verifyUser'), $user, $tpl);
             } else {
                 eZDebug::writeWarning("Unknown VerifyUserType '{$verifyUserType}'", 'ngconnect/profile');
             }
         }
     }
     // send verification mail to user if email type or custom verify user type returned true
     if ($sendUserMail) {
         $mail = new eZMail();
         $templateResult = $tpl->fetch('design:user/registrationinfo.tpl');
         if ($tpl->hasVariable('content_type')) {
             $mail->setContentType($tpl->variable('content_type'));
         }
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if ($tpl->hasVariable('email_sender')) {
             $emailSender = $tpl->variable('email_sender');
         } else {
             if (!$emailSender) {
                 $emailSender = $ini->variable('MailSettings', 'AdminEmail');
             }
         }
         $mail->setSender($emailSender);
         if ($tpl->hasVariable('subject')) {
             $subject = $tpl->variable('subject');
         } else {
             $subject = ezpI18n::tr('kernel/user/register', 'Registration info');
         }
         $mail->setSubject($subject);
         $mail->setReceiver($user->attribute('email'));
         $mail->setBody($templateResult);
         eZMailTransport::send($mail);
     }
 }
开发者ID:netgen,项目名称:ngconnect,代码行数:80,代码来源:ngconnectuseractivation.php

示例6: eZMail

 $tpl->setVariable('object', $object);
 $tpl->setVariable('attribute_hide_list', $attributeHideList);
 $tpl->setVariable('collection', $collection);
 $tpl->setVariable('object', $object);
 $templateResult = $tpl->fetch('design:content/collectedinfomail/' . $informationCollectionTemplate . '.tpl');
 $subject = $tpl->variable('subject');
 $receiver = $tpl->variable('email_receiver');
 $ccReceivers = $tpl->variable('email_cc_receivers');
 $bccReceivers = $tpl->variable('email_bcc_receivers');
 $sender = $tpl->variable('email_sender');
 $replyTo = $tpl->variable('email_reply_to');
 $redirectToNodeID = $tpl->variable('redirect_to_node_id');
 $ini = eZINI::instance();
 $mail = new eZMail();
 if ($tpl->hasVariable('content_type')) {
     $mail->setContentType($tpl->variable('content_type'));
 }
 if (!$mail->validate($receiver)) {
     $receiver = $ini->variable("InformationCollectionSettings", "EmailReceiver");
     if (!$receiver) {
         $receiver = $ini->variable("MailSettings", "AdminEmail");
     }
 }
 $mail->setReceiver($receiver);
 if (!$mail->validate($sender)) {
     $sender = $ini->variable("MailSettings", "EmailSender");
 }
 $mail->setSender($sender);
 if (!$mail->validate($replyTo)) {
     // If replyTo address is not set in the template, take it from the settings
     $replyTo = $ini->variable("MailSettings", "EmailReplyTo");
开发者ID:stevoland,项目名称:ez_patch,代码行数:31,代码来源:collectinformation.php

示例7: testRegressionSetContentType

 /**
  * Test for issue #16401: email for confirming when anonymous is subscribing to
  * comments is in plain text, but with html tags
  */
 public function testRegressionSetContentType()
 {
     $mail = new eZMail();
     $mail->setBody(__FUNCTION__);
     $mail->setContentType("text/html");
     $ezcResult = $mail->Mail->generate();
     preg_match("/Content-Type: text\\/html/", $ezcResult, $matches);
     $this->assertEquals(1, count($matches));
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:13,代码来源:ezmail_ezc_test.php

示例8: executeBeforeLastRedirect

 public function executeBeforeLastRedirect($node)
 {
     $survey = $this->fetchFeedbackSurvey();
     $surveyQuestions = $this->feedbackQuestionList();
     $mailTo = $this->fetchMailTo($surveyQuestions);
     if ($survey = $this->fetchFeedbackSurvey() and $survey instanceof eZSurvey and $surveyQuestions = $this->feedbackQuestionList() and $mailTo = $this->fetchMailTo($surveyQuestions) and eZMail::validate($mailTo)) {
         $tpl_email = eZTemplate::factory();
         $tpl_email->setVariable('intro', $this->Text2);
         $tpl_email->setVariable('survey', $survey);
         $tpl_email->setVariable('survey_questions', $surveyQuestions);
         $tpl_email->setVariable('survey_node', $node);
         $templateResult = $tpl_email->fetch('design:survey/feedbackfield_mail.tpl');
         if (trim($this->Text3) != '') {
             $subject = $this->Text3;
         } else {
             $subject = $tpl_email->variable('subject');
         }
         $mail = new eZMail();
         $ini = eZINI::instance();
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if (!$emailSender) {
             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
         }
         $mail->setSenderText($emailSender);
         $mail->setReceiver($mailTo);
         $mail->setSubject($subject);
         $mail->setBody($templateResult);
         if ($tpl_email->hasVariable('content_type')) {
             $mail->setContentType($tpl_email->variable('content_type'));
         }
         if ($this->Num == 1) {
             $adminReceiver = $ini->variable('MailSettings', 'AdminEmail');
             $mail->addBcc($adminReceiver);
         }
         $mailResult = eZMailTransport::send($mail);
     }
 }
开发者ID:heliopsis,项目名称:ezsurvey,代码行数:37,代码来源:ezsurveyfeedbackfield.php

示例9: sendMail

    /**
     * Sends an email and logs all data, with send result, to previously specified log file.
     *
     * @return bool
     */
    public function sendMail()
    {
        $this->logger->log(str_pad('', 77, '*'), ezcLog::INFO);
        $this->logger->log("[Subject] " . $this->subject, ezcLog::INFO);
        $this->logger->log("[From email] " . $this->sender, ezcLog::INFO);
        $this->logger->log("[To email] " . implode(", ", $this->recipients), ezcLog::INFO);
        $this->logger->log("[Message] " . $this->message, ezcLog::INFO);
        if (!$this->canBeSend()) {
            $this->logger->log("[Send status] " . 0 . "\nImproper email data.", ezcLog::INFO);
            return false;
        }

        $email = new eZMail();
        $email->setSubject($this->subject);
        $email->setSender($this->sender);
        foreach ( $this->recipients as $recipient) {
            $email->addReceiver($recipient);
        }
        $email->setBody($this->message);
        $email->setContentType('text/plain', 'UTF-8');

        $sendStatus = eZMailTransport::send($email);
        $this->logger->log("[Send status] " . $sendStatus, ezcLog::INFO);

        return $sendStatus;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:mailTool.php

示例10: processViewActions


//.........这里部分代码省略.........
                     }
                 }
             } else {
                 if (get_class($node) == 'eZContentObjectTreeNode') {
                     eZDebug::writeWarning("Not enough permissions to read node with ID: " . $nodeID . ".", 'eZSurveyType::processViewActions');
                 } else {
                     eZDebug::writeWarning("node with ID: " . $nodeID . " does not exist.", 'eZSurveyType::processViewActions');
                     return false;
                 }
             }
         } else {
             eZDebug::writeWarning("All the postvariables {$postNodeID}, {$postContentObjectAttributeID} and {$postSurveyID} need to be supplied.", 'eZSurveyType::processViewActions');
             return false;
         }
         $nodeID = $http->postVariable($postNodeID);
         $node = eZContentObjectTreeNode::fetch($nodeID);
         if ($actionContinue === true) {
             $survey = eZSurvey::fetch($surveyID);
             $status = $survey->validateContentObjectAttributeID($contentObjectAttributeID);
             if (!$survey or !$survey->published() or !$survey->enabled() or !$survey->valid()) {
                 eZDebug::writeWarning('Survey is not valid', 'eZSurveyType::processViewActions');
                 return;
             }
             $params = array('prefix_attribute' => self::PREFIX_ATTRIBUTE, 'contentobjectattribute_id' => $contentObjectAttributeID);
             $variableArray = $survey->processViewActions($validation, $params);
             $postSurveyStoreButton = self::PREFIX_ATTRIBUTE . '_ezsurvey_store_button_' . $contentObjectAttributeID;
             $user = eZUser::currentUser();
             if ($survey->attribute('persistent')) {
                 $result = eZSurveyResult::instance($surveyID, $user->id());
             } else {
                 $result = eZSurveyResult::instance($surveyID);
             }
             $result->setAttribute('user_id', $user->id());
             $http = eZHTTPTool::instance();
             $sessionID = $http->sessionID();
             $result->setAttribute('user_session_id', $sessionID);
             if ($http->hasPostVariable($postSurveyStoreButton) && $validation['error'] == false) {
                 $result->storeResult($params);
                 $postReceiverID = self::PREFIX_ATTRIBUTE . '_ezsurvey_receiver_id_' . $contentObjectAttributeID;
                 if ($http->hasPostVariable($postReceiverID) and $questionList = $survey->fetchQuestionList() and $postReceiverQuestionID = $http->postVariable($postReceiverID) and isset($questionList[$postReceiverQuestionID])) {
                     $mailTo = $questionList[$postReceiverQuestionID]->answer();
                     $emailSenderList = explode('_', $questionList[$postReceiverQuestionID]->attribute('text3'));
                     if (isset($emailSenderList[1]) and $emailSenderID = $emailSenderList[1] and is_numeric($emailSenderID) and $emailSenderID > 0 and isset($questionList[$emailSenderID]) and $senderQuestion = $questionList[$emailSenderID] and $senderQuestion->attribute('type') == 'EmailEntry' and eZMail::validate($senderQuestion->attribute('answer'))) {
                         $emailSender = $senderQuestion->attribute('answer');
                     } else {
                         $ini = eZINI::instance();
                         $emailSender = $ini->variable('MailSettings', 'EmailSender');
                         if (!$emailSender) {
                             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
                         }
                     }
                     $tpl_email = eZTemplate::factory();
                     $tpl_email->setVariable('survey', $survey);
                     $tpl_email->setVariable('survey_questions', $questionList);
                     $tpl_email->setVariable('survey_node', $node);
                     $templateResult = $tpl_email->fetch('design:survey/mail.tpl');
                     $subject = $tpl_email->variable('subject');
                     $mail = new eZMail();
                     $mail->setSenderText($emailSender);
                     $mail->setReceiver($mailTo);
                     $mail->setSubject($subject);
                     $mail->setBody($templateResult);
                     if ($tpl_email->hasVariable('content_type')) {
                         $mail->setContentType($tpl_email->variable('content_type'));
                     }
                     $mailResult = eZMailTransport::send($mail);
                 }
                 $survey->executeBeforeLastRedirect($node);
                 $href = trim($survey->attribute('redirect_submit'));
                 $module = $GLOBALS['module'];
                 if ($module instanceof eZModule) {
                     if (trim($href) != "") {
                         if (preg_match("/^http:\\/\\/.+/", $href)) {
                             $module->redirectTo($href);
                         } else {
                             $originalHref = $href;
                             $status = eZURI::transformURI($href);
                             if ($status === true) {
                                 // Need to keep the original href, since it's
                                 // already changed here.
                                 $module->redirectTo($originalHref);
                             } else {
                                 $http->redirect($href);
                             }
                         }
                     }
                 }
             } else {
                 if ($validation['error'] == true and $survey->attribute('persistent') == true) {
                     // Fix prevous results.
                     $validation['post_variables']['active'] = true;
                     $validation['post_variables']['variables'] = $variableArray;
                 }
             }
         }
     } else {
         eZDebug::writeWarning('Answer for survey with userid: ' . $user->id() . ' does already exist', 'eZSurveyType::processViewActions');
         $validation['one_answer']['warning'] = true;
     }
 }
开发者ID:heliopsis,项目名称:ezsurvey,代码行数:101,代码来源:ezsurveytype.php

示例11: checkContentActions

 function checkContentActions($module, $class, $object, $version, $contentObjectAttributes, $EditVersion, $EditLanguage)
 {
     if ($module->isCurrentAction('Cancel')) {
         $http = eZHTTPTool::instance();
         if ($http->hasPostVariable('RedirectIfDiscarded')) {
             eZRedirectManager::redirectTo($module, $http->postVariable('RedirectIfDiscarded'));
         } else {
             eZRedirectManager::redirectTo($module, '/');
         }
         $version->removeThis();
         $http = eZHTTPTool::instance();
         $http->removeSessionVariable("RegisterUserID");
         $http->removeSessionVariable('StartedRegistration');
         return eZModule::HOOK_STATUS_CANCEL_RUN;
     }
     if ($module->isCurrentAction('Publish')) {
         $http = eZHTTPTool::instance();
         $user = eZUser::currentUser();
         $operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $object->attribute('id'), 'version' => $version->attribute('version')));
         // Break here if the publishing failed
         if ($operationResult['status'] !== eZModuleOperationInfo::STATUS_CONTINUE) {
             eZDebug::writeError('User object(' . $object->attribute('id') . ') could not be published.', 'user/register');
             $module->redirectTo('/user/register/3');
             return;
         }
         $object = eZContentObject::fetch($object->attribute('id'));
         // Check if user should be enabled and logged in
         unset($user);
         $user = eZUser::fetch($object->attribute('id'));
         $user->loginCurrent();
         $receiver = $user->attribute('email');
         $mail = new eZMail();
         if (!$mail->validate($receiver)) {
         }
         $ini = eZINI::instance();
         $tpl = eZTemplate::factory();
         $tpl->setVariable('user', $user);
         $tpl->setVariable('object', $object);
         $hostname = eZSys::hostname();
         $tpl->setVariable('hostname', $hostname);
         $password = $http->sessionVariable("GeneratedPassword");
         $tpl->setVariable('password', $password);
         // Check whether account activation is required.
         $verifyUserType = $ini->variable('UserSettings', 'VerifyUserType');
         $sendUserMail = !!$verifyUserType;
         // For compatibility with old setting
         if ($verifyUserType === 'email' && $ini->hasVariable('UserSettings', 'VerifyUserEmail') && $ini->variable('UserSettings', 'VerifyUserEmail') !== 'enabled') {
             $verifyUserType = false;
         }
         if ($verifyUserType === 'email') {
             // Disable user account and send verification mail to the user
             $userID = $object->attribute('id');
             // Create enable account hash and send it to the newly registered user
             $hash = md5(mt_rand() . time() . $userID);
             if (eZOperationHandler::operationIsAvailable('user_activation')) {
                 $operationResult = eZOperationHandler::execute('user', 'activation', array('user_id' => $userID, 'user_hash' => $hash, 'is_enabled' => false));
             } else {
                 eZUserOperationCollection::activation($userID, $hash, false);
             }
             // Log out current user
             eZUser::logoutCurrent();
             $tpl->setVariable('hash', $hash);
             $sendUserMail = true;
         } else {
             if ($verifyUserType) {
                 $verifyUserTypeClass = false;
                 // load custom verify user settings
                 if ($ini->hasGroup('VerifyUserType_' . $verifyUserType)) {
                     if ($ini->hasVariable('VerifyUserType_' . $verifyUserType, 'File')) {
                         include_once $ini->variable('VerifyUserType_' . $verifyUserType, 'File');
                     }
                     $verifyUserTypeClass = $ini->variable('VerifyUserType_' . $verifyUserType, 'Class');
                 }
                 // try to call the verify user class with function verifyUser
                 if ($verifyUserTypeClass && method_exists($verifyUserTypeClass, 'verifyUser')) {
                     $sendUserMail = call_user_func(array($verifyUserTypeClass, 'verifyUser'), $user, $tpl);
                 } else {
                     eZDebug::writeWarning("Unknown VerifyUserType '{$verifyUserType}'", 'user/register');
                 }
             }
         }
         // send verification mail to user if email type or custum verify user type returned true
         if ($sendUserMail) {
             $templateResult = $tpl->fetch('design:user/registrationinfo.tpl');
             if ($tpl->hasVariable('content_type')) {
                 $mail->setContentType($tpl->variable('content_type'));
             }
             $emailSender = $ini->variable('MailSettings', 'EmailSender');
             if ($tpl->hasVariable('email_sender')) {
                 $emailSender = $tpl->variable('email_sender');
             } else {
                 if (!$emailSender) {
                     $emailSender = $ini->variable('MailSettings', 'AdminEmail');
                 }
             }
             if ($tpl->hasVariable('subject')) {
                 $subject = $tpl->variable('subject');
             } else {
                 $subject = ezpI18n::tr('kernel/user/register', 'Registration info');
             }
//.........这里部分代码省略.........
开发者ID:rmiguel,项目名称:ezpublish,代码行数:101,代码来源:register.php

示例12: sendEmailWithEz

 /**
  *
  * @param unknown_type $emailSender
  * @param unknown_type $emailReciever
  * @param unknown_type $emailSubject
  * @param unknown_type $emailBody
  * @param string $emailContentType
  * @param string $emailCharset
  * @return array
  */
 function sendEmailWithEz($emailSender, $emailReciever, $emailSubject, $emailBody, $emailContentType = 'text/html', $emailCharset = 'utf-8')
 {
     $mail = new eZMail();
     $redirectURL = false;
     $mail->setReceiver(trim($emailReciever));
     $mail->setSender(trim($emailSender));
     $mail->setSubject($emailSubject);
     $mail->setBody($emailBody);
     // $mail->setContentType( $type = 'text/html', $charset = false, $transferEncoding = false, $disposition = false, $boundary = false);
     $mail->setContentType($emailContentType, $emailCharset, $transferEncoding = false, $disposition = false, $boundary = false);
     $emailResultArray = array();
     $emailResult = eZMailTransport::send($mail);
     $emailResult = array('email_result' => $emailResult, 'email_sender' => $emailSender, 'email_reciever' => $emailReciever, 'email_subject' => $emailSubject, 'email_content_type' => $emailContentType, 'email_charset' => $emailCharset);
     if ($mailResult === true) {
         $message = "send - " . $receiver['email'] . " - " . $receiver['name'];
     } else {
         $message = "not send - " . $receiver['email'] . " - " . $receiver['name'];
     }
     return $emailResult;
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:30,代码来源:cjwnewslettermail.php


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