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


PHP EmailTemplate::serverUrl方法代码示例

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


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

示例1: sendRecoverPasswordEmail

 /**
  * Send an email with a link to activate the users' account
  */
 function sendRecoverPasswordEmail()
 {
     $session = SessionWrapper::getInstance();
     $template = new EmailTemplate();
     // create mail object
     $mail = getMailInstance();
     // assign values
     $template->assign('firstname', $this->getFirstName());
     // just send the parameters for the activationurl, the actual url will be built in the view
     // $template->assign('resetpasswordurl', array("controller"=> "user","action"=> "resetpassword", "actkey" => $this->getActivationKey(), "id" => encode($this->getID())));
     $viewurl = $template->serverUrl($template->baseUrl('user/resetpassword/id/' . encode($this->getID()) . "/actkey/" . $this->getActivationKey() . "/"));
     $template->assign('resetpasswordurl', $viewurl);
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     // configure base stuff
     $mail->addTo($this->getEmail());
     // set the send of the email address
     $mail->setFrom(getDefaultAdminEmail(), getDefaultAdminName());
     $mail->setSubject($this->translate->_('profile_email_subject_recoverpassword'));
     // render the view as the body of the email
     $mail->setBodyHtml($template->render('recoverpassword.phtml'));
     // debugMessage($template->render('recoverpassword.phtml'));
     try {
         $mail->send();
     } catch (Exception $e) {
         $session->setVar(ERROR_MESSAGE, 'Email notification not sent! ' . $e->getMessage());
     }
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     $mail->clearFrom();
     return true;
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:37,代码来源:UserAccount.php

示例2: sendApprovalConfirmationNotification

 function sendApprovalConfirmationNotification()
 {
     $template = new EmailTemplate();
     # create mail object
     $mail = getMailInstance();
     $view = new Zend_View();
     $session = SessionWrapper::getInstance();
     // assign values
     $template->assign('firstname', $this->getUser()->getFirstName());
     $statuslabel = $this->isApproved() ? "Approved" : "Rejected";
     $subject = "Leave " . $statuslabel;
     $save_toinbox = true;
     $type = "leave";
     $subtype = "leave_" . strtolower($statuslabel);
     $viewurl = $template->serverUrl($template->baseUrl('leave/view/id/' . encode($this->getID())));
     $rejectreason = "";
     if ($this->isRejected()) {
         $rejectreason = "<br><b>Synopsis:</b> " . $this->getComments() . "";
     }
     $days = $this->getDuration() / getHoursInDay();
     $message_contents = "<p>This is to confirm that your Leave Request from <b>" . changeMySQLDateToPageFormat($this->getStartDate()) . "</b> to <b> " . changeMySQLDateToPageFormat($this->getEndDate()) . "</b> has been successfully " . $statuslabel . $rejectreason . ".</p>\n\t\t<p>To view your request online <a href='" . $viewurl . "'>click here<a></p>\n\t\t<br />\n\t\t<p>" . $this->getApprover()->getName() . "<br />\n\t\t" . getAppName() . "</p>\n\t\t";
     $template->assign('contents', $message_contents);
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     // configure base stuff
     $mail->addTo($this->getUser()->getEmail(), $this->getUser()->getName());
     // set the send of the email address
     $mail->setFrom(getDefaultAdminEmail(), getDefaultAdminName());
     $mail->setSubject($subject);
     // render the view as the body of the email
     $html = $template->render('default.phtml');
     $mail->setBodyHtml($html);
     // debugMessage($html); exit();
     if ($this->getUser()->allowEmailForTimesheetApproval() && !isEmptyString($this->getUser()->getEmail())) {
         try {
             $mail->send();
             $session->setVar("custommessage1", "Email sent to " . $this->getUser()->getEmail());
         } catch (Exception $e) {
             $session->setVar(ERROR_MESSAGE, 'Email notification not sent! ' . $e->getMessage());
         }
     }
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     $mail->clearFrom();
     if ($save_toinbox) {
         # save copy of message to user's application inbox
         $message_dataarray = array("senderid" => DEFAULT_ID, "subject" => $subject, "contents" => $message_contents, "html" => $html, "type" => $type, "subtype" => $subtype, "refid" => $this->getID(), "recipients" => array(md5(1) => array("recipientid" => $this->getUserID())));
         // debugMessage($message_dataarray);
         // process message data
         $message = new Message();
         $message->processPost($message_dataarray);
         $message->save();
     }
     return true;
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:57,代码来源:Leave.php

示例3: sendPayslipNotification

 function sendPayslipNotification()
 {
     $template = new EmailTemplate();
     # create mail object
     $mail = getMailInstance();
     $view = new Zend_View();
     $session = SessionWrapper::getInstance();
     // assign values
     $template->assign('firstname', $this->getUser()->getFirstName());
     $subject = "Payslip " . date('F Y', strtotime($this->getPayroll()->getStartDate()));
     $save_toinbox = true;
     $type = "payroll";
     $subtype = "payslip_generated";
     $viewurl = $template->serverUrl($template->baseUrl('temp/' . $this->getPDFName() . '.pdf'));
     $message_contents = "<p>This is to confirm that your Payslip for <b>" . date('F Y', strtotime($this->getPayroll()->getStartDate())) . "</b> has been completed and attached.</p>\n\t\t<p>You can also view it online <a href='" . $viewurl . "'>click here<a></p>\n\t\t<br />\n\t\t<p>" . $this->getPayroll()->getCreator()->getName() . "<br />\n\t\t" . getAppName() . "</p>\n\t\t";
     $template->assign('contents', $message_contents);
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     // configure base stuff
     $mail->addTo($this->getUser()->getEmail(), $this->getUser()->getName());
     // set the send of the email address
     $mail->setFrom(getDefaultAdminEmail(), getDefaultAdminName());
     $mail->setSubject($subject);
     // add attachment
     $content = file_get_contents($this->getPDFPath());
     // e.g. ("attachment/abc.pdf")
     $attachment = new Zend_Mime_Part($content);
     $attachment->type = 'application/pdf';
     $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
     $attachment->encoding = Zend_Mime::ENCODING_BASE64;
     $attachment->filename = $this->getPDFName();
     // name of file
     $mail->addAttachment($attachment);
     // render the view as the body of the email
     $html = $template->render('default.phtml');
     $mail->setBodyHtml($html);
     // debugMessage($html); // exit();
     if ($this->getUser()->allowEmailForPayslip() && !isEmptyString($this->getUser()->getEmail())) {
         try {
             $mail->send();
             // $session->setVar("custommessage1", "Email sent to ".$this->getUser()->getEmail());
         } catch (Exception $e) {
             debugMessage('Email notification not sent! ' . $e->getMessage());
             $session->setVar(ERROR_MESSAGE, 'Email notification not sent! ' . $e->getMessage());
         }
     }
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     $mail->clearFrom();
     if ($save_toinbox) {
         # save copy of message to user's application inbox
         $message_dataarray = array("senderid" => DEFAULT_ID, "subject" => $subject, "contents" => $message_contents, "html" => $html, "type" => $type, "subtype" => $subtype, "refid" => $this->getID(), "recipients" => array(md5(1) => array("recipientid" => $this->getUserID())));
         // debugMessage($message_dataarray);
         // process message data
         $message = new Message();
         $message->processPost($message_dataarray);
         $message->save();
     }
     return true;
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:62,代码来源:PayrollDetail.php

示例4: sendInboxEmailNotification

 /**
  * Send a notification to a user that a private message has been sent to them
  *
  * @return Bool whether the email notification has been sent
  *
  */
 function sendInboxEmailNotification($fromemail = '', $fromname = '', $subject = '', $toemail = '', $toname = '', $content = '')
 {
     $template = new EmailTemplate();
     # create mail object
     $mail = getMailInstance();
     # sender name
     $sendername = getAppName();
     $sendername = $this->getMessage()->getSender()->getName();
     if (!isEmptyString($fromname)) {
         $sendername = $fromname;
     }
     # sender email
     $senderemail = getDefaultAdminEmail();
     if (!isEmptyString($fromemail)) {
         $senderemail = $fromemail;
     }
     # receipient name
     $receivername = $this->getMessage()->getSender()->getFirstName();
     if (!isEmptyString($toname)) {
         $receivername = $toname;
     }
     # receipient email
     $receiveremail = $this->getMessage()->getSender()->getEmail();
     if (!isEmptyString($toemail)) {
         $receiveremail = $toemail;
     }
     # email subject
     $msgsubject = sprintf($this->translate->_('message_private_email_subject'), getAppName(), $subject);
     # email content
     $intro = "<p><i><b>" . $sendername . "</b> sent you a private message via <b>" . getAppName() . "</b> </i></p>";
     $msgcontent = '<p>"' . $this->getMessage()->getContents() . '"</p>';
     if (!isEmptyString($content)) {
         $msgcontent = '<p>"' . $content . '"</p>';
     }
     $viewurl = $template->serverUrl($template->baseUrl('message/view/id/' . encode($this->getID())));
     if (isEmptyString($this->getID())) {
         $viewurl = '';
     }
     $msgcontent .= '<p><a href="' . $viewurl . '">Click here</a> to view this message online</p>';
     // debugMessage($this->getRecipients()->toArray());
     // the message reciever's first name
     $template->assign('firstname', isEmptyString($toname) ? 'User' : $receivername);
     // the message sender's name
     $template->assign('emailsender', $sendername);
     // message subject
     $template->assign('subject', $msgsubject);
     $mail->setSubject($msgsubject);
     // add the recipient emails TODO if sent to many users, add all their emails
     $mail->addTo($toemail, $receivername);
     // set the send of the email address
     $mail->setFrom(getDefaultAdminEmail(), getAppName() . " on behalf of " . $fromname);
     // message contents
     $template->assign('emailcontent', $intro . nl2br($msgcontent));
     // the actual url will be built in the view
     $template->assign('emaillink', $viewurl);
     // message html file
     $mail->setBodyHtml($template->render('messagenotification.phtml'));
     // debugMessage($template->render('messagenotification.phtml'));
     // send the message
     try {
         $mail->send();
     } catch (Exception $e) {
         $session->setVar(ERROR_MESSAGE, 'Email notification not sent! ' . $e->getMessage());
     }
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     $mail->clearFrom();
     return true;
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:76,代码来源:MessageRecipient.php


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