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


PHP mailer::setBody方法代码示例

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


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

示例1: handlePost


//.........这里部分代码省略.........
     global $thinkedit;
     // if form sent, validate
     if ($this->form->isSent()) {
         $this->content->setArray($_POST);
         $valid_captcha = true;
         if ($this->enable_captcha) {
             require_once ROOT . '/class/captcha.class.php';
             $captcha = new captcha();
             if ($_REQUEST['captcha'] != $captcha->get()) {
                 $valid_captcha = false;
             }
         }
         // first case : invalid content
         if (!$this->content->validate() || !$valid_captcha) {
             $this->form->add('<div class="participation_error">');
             $this->form->add($this->invalid_message);
             $this->form->add('</div>');
         } else {
             // if a captcha was used, reset it in order to have a new one for another message
             if ($this->enable_captcha) {
                 $captcha->reset();
                 unset($_REQUEST['captcha']);
             }
             $failure = false;
             // save content to db
             if (!$this->content->insert()) {
                 $failure = true;
             }
             // add content to curent node
             if (isset($this->parent_node)) {
                 // add content in the container
                 $new_node = $this->parent_node->add($this->content, 'bottom');
                 if (!$new_node) {
                     $failure = true;
                 }
                 /*
                 // update db
                 if (!$new_node->save())
                 {
                 		$failure = true;
                 }
                 */
                 //echo 'publish : ' . $new_node->get('publish');
                 // publish if needed
                 if ($this->enable_moderation) {
                     //echo 'moderation enabled';
                 } else {
                     //echo 'moderation disabled, publishing directly';
                     $new_node->publish();
                 }
                 //echo 'publish after : ' . $new_node->get('publish');
                 /*
                 // move to bottom of curent branch if needed
                 if ($this->move_to_bottom)
                 {
                 		$new_node->moveBottom();
                 		echo 'publish after move to bottom : ' . $new_node->get('publish');
                 }
                 else
                 {
                 		$new_node->rebuild();
                 		echo 'publish after rebuild : ' . $new_node->get('publish');
                 }
                 */
             }
             if ($failure) {
                 $this->form->add('<div class="participation_error">');
                 $this->form->add($this->failure_message);
                 $this->form->add('</div>');
             } else {
                 if (isset($this->notification_email)) {
                     require_once ROOT . '/class/mailer.class.php';
                     $mailer = new mailer();
                     $mailer->isHtml(true);
                     $mailer->setTo($this->notification_email);
                     // todo : find the first email field type in the record to use it as a sender
                     // $mailer->setFrom($this->notification_email);
                     $mailer->setSubject($this->notification_email_subject . $this->content->getTitle());
                     $message = '';
                     foreach ($this->content->field as $field) {
                         $message .= '<b>' . $field->getTitle();
                         $message .= ' : ' . '</b>';
                         $message .= '<br/>';
                         $message .= $field->get();
                         $message .= '<br/>';
                         $message .= '<br/>';
                     }
                     $url = $thinkedit->newUrl();
                     $url->set('node_id', $this->parent_node->getId());
                     $message .= '<a href="' . $url->renderAbsoluteUrl('/edit/structure.php') . '">' . translate('participation_email_admin_link') . '</a>';
                     $mailer->setBody($message);
                     $mailer->send();
                 }
                 $this->form->add('<div class="participation_success">');
                 $this->form->add($this->success_message);
                 $this->form->add('</div>');
             }
         }
     }
 }
开发者ID:philippejadin,项目名称:thinkedit,代码行数:101,代码来源:participation.class.php


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