當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Gems_Loader::getMail方法代碼示例

本文整理匯總了PHP中Gems_Loader::getMail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gems_Loader::getMail方法的具體用法?PHP Gems_Loader::getMail怎麽用?PHP Gems_Loader::getMail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gems_Loader的用法示例。


在下文中一共展示了Gems_Loader::getMail方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendMail

 /**
  * Send an e-mail to this user
  *
  * @param string $subjectTemplate A subject template in which {fields} are replaced
  * @param string $bbBodyTemplate A BB Code body template in which {fields} are replaced
  * @param boolean $useResetFields When true get a reset key for this user
  * @param string $locale Optional locale
  * @return mixed String or array of warnings when something went wrong
  */
 public function sendMail($subjectTemplate, $bbBodyTemplate, $useResetFields = false, $locale = null)
 {
     if ($useResetFields && !$this->canResetPassword()) {
         return $this->_('Trying to send a password reset to a user that cannot be reset.');
     }
     $mail = $this->loader->getMail();
     $mail->setTemplateStyle($this->getBaseOrganization()->getStyle());
     $mail->setFrom($this->getFrom());
     $mail->addTo($this->getEmailAddress(), $this->getFullName(), $this->project->getEmailBounce());
     if ($bcc = $this->project->getEmailBcc()) {
         $mail->addBcc($bcc);
     }
     if ($useResetFields) {
         $fields = $this->getResetPasswordMailFields($locale);
     } else {
         $fields = $this->getMailFields($locale);
     }
     // \MUtil_Echo::track($fields, $bbBodyTemplate);
     $fields = \MUtil_Ra::braceKeys($fields, '{', '}');
     $mail->setSubject(strtr($subjectTemplate, $fields));
     $mail->setBodyBBCode(strtr($bbBodyTemplate, $fields));
     try {
         $mail->send();
         return null;
     } catch (\Exception $e) {
         return array($this->_('Unable to send e-mail.'), $e->getMessage());
     }
 }
開發者ID:GemsTracker,項目名稱:gemstracker-library,代碼行數:37,代碼來源:User.php

示例2: send

 /**
  * Send the mail
  */
 public function send()
 {
     $mail = $this->loader->getMail();
     $mail->setFrom($this->from);
     $mail->addTo($this->to, '', $this->bounceCheck());
     if (isset($this->project->email['bcc'])) {
         $mail->addBcc($this->project->email['bcc']);
     }
     $mail->setSubject($this->applyFields($this->subject));
     $mail->setTemplateStyle($this->getTemplateStyle());
     if ($this->bodyBb) {
         $mail->setBodyBBCode($this->applyFields($this->bodyBb));
     } elseif ($this->bodyHtml) {
         $mail->setBodyHtml($this->applyFields($this->bodyHtml));
     } elseif ($this->bodyText) {
         $mail->setBodyText($this->applyFields($this->bodyText));
     }
     $this->beforeMail();
     $mail->send();
     $this->afterMail();
 }
開發者ID:harmslijper,項目名稱:gemstracker-library,代碼行數:24,代碼來源:MailerAbstract.php


注:本文中的Gems_Loader::getMail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。