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


PHP NotificationMail::isHTML方法代码示例

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


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

示例1: validateSendTo

 /**
  * Override standard validation and sending notification to send the good PDF reports with 
  * appropriate rigths.
  * 
  * @see NotificationTarget::validateSendTo()
  * 
  * @param string $event notification event
  * @param Array $infos Current user informations
  * @param Boolean $notify_me Notify the current user of his own actions ?
  * 
  * @return boolean false to prevent standard mail sending
  */
 function validateSendTo($event, array $infos, $notify_me = false)
 {
     global $DB;
     if (isset($infos['users_id'])) {
         // save session variables
         $saved_session = $_SESSION;
         // Get current user full informations
         $user = new User();
         $user->getFromDB($infos['users_id']);
         // inialize session for user to build the proper PDF report
         unset($_SESSION['glpiprofiles'], $_SESSION['glpiactiveentities'], $_SESSION['glpiactiveprofile']);
         Session::initEntityProfiles($infos['users_id']);
         // Use default profile if exist
         if (isset($_SESSION['glpiprofiles'][$user->fields['profiles_id']])) {
             Session::changeProfile($user->fields['profiles_id']);
             // Else use first
         } else {
             Session::changeProfile(key($_SESSION['glpiprofiles']));
         }
         $user_name = $infos['username'] . '_';
         $file_name = $this->_buildPDF($user_name);
         $path = GLPI_PLUGIN_DOC_DIR . '/mreporting/notifications/' . $file_name;
         $mmail = new NotificationMail();
         $mmail->AddCustomHeader("Auto-Submitted: auto-generated");
         // For exchange
         $mmail->AddCustomHeader("X-Auto-Response-Suppress: OOF, DR, NDR, RN, NRN");
         // Get current entity administrator info to send the email from him
         $admin = $this->getSender();
         $mmail->From = $admin['email'];
         $mmail->FromName = $admin['name'];
         // Attach pdf to mail
         $mmail->AddAttachment($path, $file_name);
         // Get content infos
         $query = 'SELECT * 
               FROM glpi_notificationtemplatetranslations
               WHERE notificationtemplates_id = (
                  SELECT id 
                  FROM glpi_notificationtemplates 
                  WHERE itemtype = "PluginMreportingNotification"
               )
               AND (language LIKE "' . $_SESSION['glpilanguage'] . '" OR language LIKE "")
               ORDER BY language DESC
               LIMIT 0, 1';
         $result = $DB->query($query);
         $translation = $result->fetch_array();
         $mmail->isHTML(true);
         $mmail->Subject = $translation['subject'];
         $mmail->Body = $translation['content_html'];
         $mmail->AltBody = $translation['content_text'];
         $mmail->AddAddress($infos['email']);
         if ($mmail->Send()) {
         }
         //restore session
         unset($_SESSION);
         $_SESSION = $saved_session;
     }
     return false;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:70,代码来源:notificationtargetnotification.class.php

示例2: die

if (isset($_GET['help'])) {
   die("usage php testmail.php  [ --from=email ] --to=email [ --enc=7bit|8bit|binary|base64|quoted-printable ]\n");
}

$dat     = date('r');
$secret  = "l'été, ça roule !";

echo "From : $from\n";
echo "To : $dest\n";
echo "Date : $dat\n";

$mmail = new NotificationMail();
$mmail->From=$from;
$mmail->FromName="GLPI test";
$mmail->isHTML(true);

if ($enc) {
   $mmail->Encoding = $enc;
}

$mmail->Subject="GLPI test mail" . ($enc ? " ($enc)" : '');
$mmail->Body="<html><body><h3>GLPI test mail</h3><p>Encoding = <span class='b'>$enc</span></p>".
             "<p>Date = <span class='b'>$dat</span></p><p>Secret = <span class='b'>$secret</span>".
             "</p></body></html>";
$mmail->AltBody="GLPI test mail\nEncoding : $enc\nDate : $dat\nSecret=$secret";

$mmail->AddAddress($dest, "");

$logo=file_get_contents("../pics/logo-glpi-login.png");
$mmail->AddStringAttachment($logo,'glpi.png',($enc?$enc:'base64'),'image/png');
开发者ID:KaneoGmbH,项目名称:glpi,代码行数:30,代码来源:testmail.php


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