Trace: » How To Use a Template for the Emails Sent when there is a Ticket Follow-up

How To Use a Template for the Emails Sent when there is a Ticket Follow-up

  • By Cédric Richez
  • Multilingual Modif by sbonn
  • English Translation by jcoleman

1 - Why

This handling makes it possible to use a template at the time of the sending of follow-ups by email, in order to better be able to manage appearance of it. That makes it possible for example, if your company has a gate Intranet, to adapt the template email so that it corresponds.

2 - How To

The Email Template

First it is necessary to create a file named mail.tpl in the folder files containing the following html code (this code is an example. You can adapt it to your needs since it is a template):

0.7
<html>
	<head>
	<style type= " text/Cs " >
		body {makes-family: Verdana; make-size: 11px; text-align: left;}
		td {makes-family: Verdana; make-size: 11px; text-align: left;}
		#description {
			make-family: verdana;
			make-size: 11px;
			color: inherit;
			background: #FFF;
			border-style: solid;
			to border-color: #A2BB8D;
			to border-width: 1px 0px 1px 0px;
			make-weight: nun;
			text-align: center;
		}
 
		#page {
			background-color: #FFF;
			width: 590px;
		}
 
		#top {
			make-family: verdana;
			make-size: 12px;
			text-align: center;
		}
 
		#signature {
			width: 590px;
			text-align: center;
			make-family: verdana;
			make-size: 11px;	
		}
	</style>
	</head>
	<body>
	<div align=' center'>
		<div id=' page'>
			<div id=' top'>
                        <br>##t_link##: ##link##
			<br><br>
			- ##ticketFollowUp## -
			</div><br><br>
			<div id=' description'>
			<br>##title##<br><br>
			<table width=' 590px' border=1>
			<tr><td width=' auto' bgcolor='#A2BB8D'>##t_author##</td><td>##author##</td><td  width=' auto' bgcolor='#A2BB8D'>##t_date##</td><td>##date##</td></tr>
			<tr><td  width=' auto' bgcolor='#A2BB8D'>##t_request##</td><td>##request##</td><td  width=' auto' bgcolor='#A2BB8D'>##t_equipment##</td><td>##equipment##</td></tr>
			<tr><td  width=' auto' bgcolor='#A2BB8D'>##t_status## </td><td>##status##</td><td  width=' auto' bgcolor='#A2BB8D'>##t_assign##</td><td>##assign##</td></tr>
			<tr><td  width=' auto' bgcolor='#A2BB8D'>##t_priority##</td><td>##priority##</td><td  width=' auto' bgcolor='#A2BB8D'>##t_contact##</td><td>##contact##</td></tr>
			<tr><td  width=' auto' bgcolor='#A2BB8D'>##t_emailupdate##</td><td>##emailupdate##</td><td  width=' auto' bgcolor='#A2BB8D'>##t_category##</td><td>##category##</td></tr>
			<tr><td  width=' auto' bgcolor='#A2BB8D'>##t_filesname##</td><td colspan=' 3 ' width=' auto'>##filesname##</td></tr>
			<tr><td  colspan=' 4 ' width=' auto' bgcolor='#A2BB8D'>##t_content##</td></tr>
                       <tr><td colspan=' 2 ' width=' auto' bgcolor='#A2BB8D'>##t_title_ticket## </td><td colspan=' 2 ' width=' auto'>##title_ticket##</td></tr>
			<tr><td colspan=' 4 ' width=' auto'>##content##</td></tr></table><br>
			<table width=' 590px' border=1>
			<tr><td colspan=' 2 ' width=' auto'>##followup##</td></tr></table><br></div><br>
		</div>
		<div id=' signature'>##signature##</div>
	</div>
	</body>
</html>
0.68
<html>
        <head>
                <style type= " text/Cs " >
                        body {margin: 0px;}
                        #description {
                                color: inherit;
                                background: #ebebeb;
                                border-style: solid;
                                to border-color: #8d8d8d;
                                to border-width: 0px 1px 0px 0px;
                                make-weight: bold;
                        }
 
                        #back {
                                background-color: #898989;
                        }
                        #sidebar {
                                float: left;
                                width: 250px;
                        }
 
                        #page {
                                background-color: #FFF;
                                margin-left: 251px;
                                width: 590px;
                        }
                        #top {
                                height: 80px;
                                width: 590px;
                        }
                        #followup {
                                make-size: 8px;
                        }
                        #signature {
                                text-align: right;
                        }
                </style>
        </head>
        <body>
                <div id=' back'>
                        <div id=' sidebar'>
                                <h1>La Side Barre</h1>
                        </div>
                        <div id=' page'>
                                <div id=' top'>
                                        Follow-up of intervention GLPI
                                </div>
                                <div id=' description'>##title##</div>
 
                                Author: ##author## <br/>
                                Date beginning: ##date##<br/>
                                Source of the request: ##request## <br/>
                                Material concerned: ##equipment##<br/>
                                Statute: ##status## <br/>
                                Allotted: ##assign##<br/>
                                Priority: ##priority##<br/>
                                Contact: ##contact## <br/>
                                Follow-up by email: ##emailupdate## <br/>
                                Category: ##category##<br/>
                                Contents:
                                <div id=' contents'>##content##</div>
 
                                <div id=' followup'>##followup##</div>
                        </div>
                        <div id=' signature'>##signature##</div>
                </div>
        </body>
</html>

Modifications of the code 0.70.1 - 0.70.2 - 0.71.0 - 0.71.1 - 0.71.2 - 0.71.5 - 0.72 - 0.72.1

Then to be able to use the template it is necessary to modify some parts of code, the first modification is carried out in the file tracking.class.php in the folder inc

Go to line 609 and replace the following code:

(line 765 for GLPI 0.71.1) (line 770 for GLPI 0.71.2 and 0.71.5) (line 829 for GLPI 0.72 and 0.72.1) (line 837 for GLPI 0.72.3)

function textfollowups
 
               if($format=="html"){
				$message = "<div class='description'><strong>".$LANG["mailing"][4]." : $nbfollow<br></strong></div><br>";
 
				if ($nbfollow>0){
					$fup=new Followup();
					while ($data=$DB->fetch_array($result)){
						$fup->getfromDB($data['ID']);
						$message .= "<strong>[ ".convDateTime($fup->fields["date"])." ] ".($fup->fields["private"]?"<i>".$LANG["job"][30]."</i>":"")."</strong><br>";
						$message .= "<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["job"][4].":</span> ".$fup->getAuthorName()."<br>";
						$message .= "<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["mailing"][3]."</span>:<br>".nl2br($fup->fields["contents"])."<br>";
						if ($fup->fields["realtime"]>0)
							$message .= "<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["mailing"][104].":</span> ".getRealtime($fup->fields["realtime"])."<br>";
 
						$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["mailing"][25]."</span> ";
						$query2="SELECT * from glpi_tracking_planning WHERE id_followup='".$data['ID']."'";
						$result2=$DB->query($query2);
						if ($DB->numrows($result2)==0)
							$message.=$LANG["job"][32]."<br>";
						else {
							$data2=$DB->fetch_array($result2);
							$message.=convDateTime($data2["begin"])." -> ".convDateTime($data2["end"])."<br>";
						}
 
						$message.=$LANG["mailing"][0]."<br>";	
					}	
				}
			}else{ // text format

By the following code:

  if($format=="html"){
				$message = "<div class='description'><strong>".$LANG["mailing"][4]." : $nbfollow<br></strong></div><br>";
 
				if ($nbfollow>0){
					$fup=new Followup();
			//modif tsmr
					while ($data=$DB->fetch_array($result)){
						$fup->getfromDB($data['ID']);
						$message .= "<tr><td colspan='2' bgcolor='#A2BB8D'>[ ".convDateTime($fup->fields["date"])." ] ".($fup->fields["private"]?"<i>".$LANG["common"][77]."</i>":"")."</td></tr>";
						$message .= "<tr><td width='95' bgcolor='#A2BB8D'>".$LANG["common"][37]." :</td><td> ".$fup->getAuthorName()."</td></tr>";
						$message .= "<tr><td width='95' bgcolor='#A2BB8D'>".$LANG["mailing"][3]." :</td><td>".nl2br($fup->fields["contents"])."</td></tr>";
						if ($fup->fields["realtime"]>0)
							$message .= "<tr><td width='95' bgcolor='#A2BB8D'>".$LANG["mailing"][104]." :</td><td> ".getRealtime($fup->fields["realtime"])."</td></tr>";
 
						$message.="<tr><td width='95' bgcolor='#A2BB8D'>".$LANG["mailing"][25]."</td>";
						$query2="SELECT * from glpi_tracking_planning WHERE id_followup='".$data['ID']."'";
						$result2=$DB->query($query2);
						if ($DB->numrows($result2)==0)
							$message.="<td>".$LANG["job"][32]."</td></tr>";
						else {
							$data2=$DB->fetch_array($result2);
							$message.="<td>".convDateTime($data2["begin"])." -> ".convDateTime($data2["end"])."</td></tr>";
						}
 
						//$message.=$lang["mailing"][0];	
					}
				//fin modif tsmr	
				}
			}else{ // text format

Then go to line 666 and replace the following code:

(line 833 for GLPI 0.71.1) (line 836 for GLPI 0.71.2) (line 834 for GLPI 0.71.5) (line 903 for GLPI 0.72, 0.72.1, and 0.72.3)

function textDescription ($format= " text ") {
		total $DB, $LANG;
 
 
		$name=$LANG [“help”] [30];
		$contact= '';
		$tech= '';

By the following code:

	function textDescription ($format= " text ") {
		total $DB, $LANG, CFG_GLPI;
 
 
		$name=$LANG [“help”] [30];
		$contact= '';
		$tech= '';
		$link= '';

Then go to line 698 and replace the following code:

(line 881 for GLPI 0.71.1) (line 885 for GLPI 0.71.2) (line 882 for GLPI 0.71.5) (line 952 for GLPI 0.72, 0.72.1, and 0.72.3)

function textDescription
 
if($format=="html"){
			$message= "<html><head> <style type="text/css">";
			$message.=".description{ color: inherit; background: #ebebeb; border-style: solid; border-color: #8d8d8d; border-width: 0px 1px 1px 0px; }";
			$message.=" </style></head><body>";
 
			$message.="<div class='description'><strong>".$LANG["mailing"][5]."</strong></div><br>";
 
			$author=$this->getAuthorName();
			if (empty($author)) $author=$LANG["mailing"][108];
			$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["job"][4].":</span> ".$author."<br>";
			$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>". $LANG["search"][8].":</span> ".convDateTime($this->fields["date"])."<br>";
			$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>". $LANG["job"][44].":</span> ".getRequestTypeName($this->fields["request_type"])."<br>";
			$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>". $LANG["mailing"][7].":</span> ".$name."<br>";
			if (!empty($tech))
				$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>". $LANG["common"][10].":</span> ".$tech."<br>";
			$message.= "<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["joblist"][0].":</span> ".getStatusName($this->fields["status"])."<br>";
			$assign=getAssignName($this->fields["assign"],USER_TYPE);
			$assign_group="";
			if (isset($this->fields["assign_group"])){
				$assign_group=getAssignName($this->fields["assign_group"],GROUP_TYPE);
			}
			if ($assign=="[Nobody]"){
				if (!empty($assign_group)){
					$assign=$assign_group;
				} else {
					$assign=$LANG["mailing"][105];
				}
			} else {
				if (!empty($assign_group)){
					$assign.=" / ".$assign_group;
				}
			}
			$message.= "<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["mailing"][8].":</span> ".$assign."<br>";
			$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["joblist"][2].":</span> ".getPriorityName($this->fields["priority"])."<br>";
			if ($this->fields["device_type"]!=SOFTWARE_TYPE&&!empty($contact))
				$message.= "<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["mailing"][28].":</span> ".$contact."<br>";
			if ($this->fields["emailupdates"]){
				$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["mailing"][103].":</span> ".$LANG["choice"][1]."<br>";
			} else {
				$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["mailing"][103].":</span> ".$LANG["choice"][0]."<br>";
			}
 
			$message.= "<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["common"][36].":</span> ";
			if (isset($this->fields["category"])&&$this->fields["category"]){
				$message.= getDropdownName("glpi_dropdown_tracking_category",$this->fields["category"]);
			} else $message.=$LANG["mailing"][100];
			$message.= "<br>";
			$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>".$LANG["common"][57].":</span> ".$this->fields["name"]."<br>";
			$message.="<span style='color:#8B8C8F; font-weight:bold;  text-decoration:underline; '>". $LANG["mailing"][3].":</span><br>".nl2br($this->fields["contents"])."<br><br>";	
 
		}else{ //text format

With the following code:

if($format=="html"){
            //modif tsmr
            $filename = GLPI_ROOT."/files/mail.tpl";
 
             $handle = fopen ($filename, "r");
            $message = fread ($handle, filesize ($filename));
            fclose ($handle);
 			if ($CFG_GLPI["url_in_mail"]&&!empty($CFG_GLPI["url_base"])){
                $link ="<div align='center'><a href=".$CFG_GLPI["url_base"]."/index.php?redirect=tracking_".$this->fields["ID"].">".$CFG_GLPI["url_base"]."/index.php?redirect=tracking_".$this->fields["ID"]."</a></div>";
             }		
            $message = ereg_replace("##link##",$link,$message);
            $message = ereg_replace("##t_link##",$LANG['document'][33],$message);
 
            $message = ereg_replace("##title##",$LANG["mailing"][5],$message);
 
            $message = ereg_replace("##ticketFollowUp##",$LANG['title'][10],$message);
 
            $author=$this->getAuthorName();
            if (empty($author)) $author=$LANG["mailing"][108];
            $message = ereg_replace("##author##",$author,$message);
            $message = ereg_replace("##t_author##",$LANG['common'][37],$message);
 
            $message = ereg_replace('##date##',convDateTime($this->fields["date"]),$message);
            $message = ereg_replace('##t_date##',$LANG['joblist'][11],$message);
            $message = ereg_replace('##request##',getRequestTypeName($this->fields["request_type"]),$message);
            $message = ereg_replace('##t_request##',$LANG['job'][44],$message);
            $message = ereg_replace('##equipment##',$name,$message);
            $message = ereg_replace('##t_equipment##',$LANG['mailing'][7],$message);
 
            //if (!empty($tech))
            //$message.=ereg_replace('##tech##',$tech,$message);
            $message = ereg_replace('##status##',getStatusName($this->fields["status"]),$message);
            $message = ereg_replace('##t_status##',$LANG['joblist'][0],$message);
            $assign=getAssignName($this->fields["assign"],USER_TYPE);
            $assign_group="";
            if (isset($this->fields["assign_group"])){
                $assign_group=getAssignName($this->fields["assign_group"],GROUP_TYPE);
            }
            if ($assign=="[Nobody]"){
                if (!empty($assign_group)){
                    $assign=$assign_group;
                } else {
                    $assign=$LANG["mailing"][105];
                }
            } else {
                if (!empty($assign_group)){
                    $assign.=" / ".$assign_group;
                }
            }
            $message = ereg_replace('##assign##',$assign,$message);
            $message = ereg_replace('##t_assign##',$LANG['mailing'][8],$message);
            $message = ereg_replace('##priority##',getPriorityName($this->fields["priority"]),$message);
            $message = ereg_replace('##t_priority##',$LANG['joblist'][2],$message);
            $message = ereg_replace('##t_contact##',$LANG['common'][18],$message);
            if ($this->fields["device_type"]!=SOFTWARE_TYPE&&!empty($contact))
                    $message = ereg_replace('##contact##',$contact,$message);
            else
                    $message = ereg_replace('##contact##','',$message);
            if ($this->fields["emailupdates"]==1){
                    $message = ereg_replace('##emailupdate##',$LANG["choice"][1],$message);
            }else{
                    $message = ereg_replace('##emailupdate##',$LANG["choice"][0],$message);
            }
            $message = ereg_replace('##t_emailupdate##',$LANG['mailing'][103],$message);
 
            if (isset($this->fields["category"])&&$this->fields["category"]){
                    $message = ereg_replace('##category##',getDropdownName("glpi_dropdown_tracking_category",$this->fields["category"]),$message);
            }else{
                    $message = ereg_replace('##category##',$LANG["mailing"][100],$message);
            }
            $message = ereg_replace('##t_category##',$LANG['common'][36],$message);
                        $message = ereg_replace('##title_ticket##',$this->fields["name"],$message);
                        $message = ereg_replace('##t_title_ticket##',$LANG['common'][57],$message);
            $message = ereg_replace('##content##',nl2br($this->fields["contents"]),$message);
            $message = ereg_replace('##t_content##',$LANG['mailing'][3],$message);
            //fin modif tsmr
            if (strlen($this->getNameOfFiles())==0)
            	$message = ereg_replace("##filesname##",$LANG['common'][49],$message);
            else
            	$message = ereg_replace("##filesname##",$this->getNameOfFiles(),$message);
 
            $message = ereg_replace("##t_filesname##",$LANG['document'][21],$message);            
 			//fin modif sbonn
        }else{ //text format

Moreover, it is necessary to add a function (it does not matter where in the file you add it. I put it at the top of the function textDescription)

/**
	 * Get names of linked files
	 * @author sbonn
	 * 
	 */
	function getNameOfFiles() {
		// File associated ?
		global $DB,$LANG;
 
		$query2 = "SELECT * 
			FROM glpi_doc_device 
			WHERE glpi_doc_device.FK_device = '".$this->fields["ID"]."' AND glpi_doc_device.device_type = '".TRACKING_TYPE."' ";
		$result2 = $DB->query($query2);
		$numfiles=$DB->numrows($result2);
 
		if ($numfiles>0){
			$message="";			
			$doc=new Document;
			while ($data=$DB->fetch_array($result2)){
				$doc->getFromDB($data["FK_doc"]);
 
				$splitter=explode("/",$doc->fields["filename"]);
				if (count($splitter)==2)
					$fileout=$splitter[1];
				else $fileout=$doc->fields["filename"];
				$message.=$fileout.", ";
 
			}
			return substr($message,0,-2);
		}else return "";
	}
 
 

Most of the work is done, but we haven't finished yet. It is also necessary to modify the file mailing.class.php which is located in the folder inc.

Go to line 347 and replace the following code:

(line 427 for GLPI 0.71.1, 0.71.2 and 0.71.5) (line 422 for GLPI 0.72.1) (line 433 for GLPI 0.72.3)

if($format=="html"){
			if ($CFG_GLPI["url_in_mail"]&&!empty($CFG_GLPI["url_base"])){
				$body.="URL :<a href="".$CFG_GLPI["url_base"]."/index.php?redirect=tracking_".$this->job->fields["ID"]."">".$CFG_GLPI["url_base"]."/index.php?redirect=tracking_".$this->job->fields["ID"]." </a><br><br>";
 
			}
 
			$body.=$this->job->textDescription($format);
			$body.=$this->job->textFollowups($format, $sendprivate);
 
			$body.="<br>-- <br>".$CFG_GLPI["mailing_signature"];
			$body.="</body></html>";
			$body=ereg_replace("n","<br>",$body);
 
		}else{ // text format

with the following code:

if($format=="html"){
			/*if ($CFG_GLPI["url_in_mail"]&&!empty($CFG_GLPI["url_base"])){
				$body.="URL :<a href="".$CFG_GLPI["url_base"]."/index.php?redirect=tracking_".$this->job->fields["ID"]."">".$CFG_GLPI["url_base"]."/index.php?redirect=tracking_".$this->job->fields["ID"]." </a><br><br>";
 
			}
*/
 
			$body.=$this->job->textDescription($format);
			$body = ereg_replace('##followup##',$this->job->textFollowups("html",$sendprivate),$body);
                        $body = ereg_replace('##signature##',$CFG_GLPI["mailing_signature"],$body);
			/*
			$body.=$this->job->textFollowups($format, $sendprivate);
 
			$body.="<br>-- <br>".$CFG_GLPI["mailing_signature"];
			$body.="</body></html>";
			$body=ereg_replace("n","<br>",$body);
*/
		}else{ // text format

Modifications of code 0.68

FIXME - (Code boxes say “yew” instead of “if”)

Then to be able to use the template it is necessary to modify some parts of code, the first modification is carried out in the file tracking.class.php in repertory Inc

Return to line 559 and replace the following code:

    yew ($format== " HTML ") {
                        $message=<html><head> <style type= " text/Cs " >;
                        $message.= " .description {color: inherit; background: #ebebeb; border-style: solid; to border-color: #8d8d8d; to border-width: 0px 1px 1px 0px; } “;
                        $message.= " </style></head><body> ";
 
                        $message.= " <div class=' description'><strong> ". $lang [“mailing”] [5]. “</strong></div><br>”;
                        $author=$this->getAuthorName ();
                        yew (empty ($author)) $author=$lang [“mailing”] [108];
                        $message.= " <span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '> ". $lang [“common”] [37]. ”: </span> “. $author. “<br>”;
                        $message.= " <span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '> ". $lang [“search”] [8]. ”: </span> “.convDateTime ($this->fields [“date”]). “<br>”;
                        $message.= " <span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '> ". $lang [“job”] [44]. ”: </span> “.getRequestTypeName ($this->fields [“request_type”]). “<br>”;
                        $message.= " <span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '> ". $lang [“mailing”] [7]. “</span>”. $name. “<br>”;
                        $message.= “<span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '>”. $lang [“joblist”] [0]. ”: </span> “.getStatusName ($this->fields [“status”]). “<br>”;
                        $assign=getAssignName ($this->fields [“assign”], USER_TYPE);
                        yew ($assign== " [Nobody])
                                $assign=$lang [“mailing”] [105];
                        $message.=<span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '>. $lang [“mailing”] [8].</span>. $assign.<br>;
                        $message.= " <span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '> ". $lang [“joblist”] [2].: </span>.getPriorityName ($this->fields [“priority”]).<br>;
                        yew ($this->fields [“device_type”]! =SOFTWARE_TYPE)
                                $message.=<span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '>. $lang [“mailing”] [28].</span>. $contact.<br>;
                        yew ($this->fields [“emailupdates”] == " yes”) {
                                $message.= " <span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '> ". $lang [“mailing”] [103]. “</span>”. $lang [“choice”] [1]. “<br>”;
                        } else {
                                $message.= " <span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '> ". $lang [“mailing”] [103]. “</span>”. $lang [“choice”] [0]. “<br>”;
                        }
 
                        $message.= “<span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '>”. $lang [“common”] [36]. ”: </span> “;
                        yew (isset ($this->fields [“category”]) &&$this->fields [“category”]) {
                                $message.= getDropdownName (“glpi_dropdown_tracking_category”, $this->fields [“category”]);
                        } else $message.=$lang [“mailing”] [100];
                        $message.= “<br>”;
 
                        $message.= " <span style=' color: #8B8C8F; make-weight: bold;  text-decoration: underline; '> ". $lang [“mailing”] [3]. “</span><br>” .nl2br ($this->fields [“content”]). “<br><br>”;
 
                } else {//text format

By the following code:

       yew ($format== " HTML ") {
                        $filename =. /files/mail.tpl”;
                        $handle = fopen ($filename, “R”);
                        $message = fread ($handle, filesize ($filename));
                        fclose ($handle);
 
                        $message = ereg_replace (##title##”, $lang [“mailing”] [5], $message);
 
                        $author=$this->getAuthorName ();
                        yew (empty ($author)) $author=$lang [“mailing”] [108];
                        $message = ereg_replace (##author##”, $author, $message);
 
                        $message = ereg_replace (##date##”, convDateTime ($this->fields [“date”]), $message);
                        $message = ereg_replace (##request##”, getRequestTypeName ($this->fields [“request_type”]), $message);
                        $message = ereg_replace (##equipment##”, $name, $message);
                        $message = ereg_replace (##status##”, getStatusName ($this->fields [“status”]), $message);
                        $assign=getAssignName ($this->fields [“assign”], USER_TYPE);
                        yew ($assign== " [Nobody] “)
                                $assign=$lang [“mailing”] [105];
                        $message = ereg_replace (“##assign##”, $assign, $message);
                        $message = ereg_replace (“##priority##”, getPriorityName ($this->fields [“priority”]), $message);
                        yew ($this->fields [“device_type”]! =SOFTWARE_TYPE)
                                $message = ereg_replace (“##contact##”, $contact, $message);
 
                        yew ($this->fields [“emailupdates”] == " yes”) {
                                $message = ereg_replace (##emailupdate##”, $lang [“choice”] [1], $message);
                        } else {
                                $message = ereg_replace (##emailuptade##”, $lang [“choice”] [0], $message);
                        }
 
                        yew (isset ($this->fields [“category”]) &&$this->fields [“category”]) {
                                $message = ereg_replace (##category##”, getDropdownName (“glpi_dropdown_tracking_category”, $this->fields [“category”]), $message);
                        } else {
                                $message = ereg_replace (##category##”, $lang [“mailing”] [100], $message);
                        }
 
                        $message = ereg_replace (##content##”, nl2br ($this->fields [“content”]), $message);
 
                } else {//text format

Here for largest of work, but it is not finished, it is necessary to modify the file mailing.class.php always located in repertory Inc . Return to line 269 and replace the following code:

                        $body.=$this->job->textFollowups (“HTML”);
                        $body.= " <br>-- <br> ". $cfg_glpi [“mailing_signature”];
 
                        $body.= " </body></html> ";
                        $body=ereg_replace (“N”,<br>, $body);

By the following code:

                        $body = ereg_replace (##followup##”, $this->job->textFollowups (“HTML”), $body);
                        $body = ereg_replace (##signature##”, $cfg_glpi [“mailing_signature”], $body);

Conclusion

You are done. You have added the ability to manage the appearance of emails sent in HTML format. You don't need to modify the GLPI code every time you want to change the email appearance; rather it is enough for you to just modify the template mail.tpl to get the page layout you want.

Here is the list of the tags that you can use to post the information you wish in the template:

##title##: Title
##author##: Author of the Ticket
##date##: Date from the request
##request##: Source of the request
##equipment##: Material to which the ticket relates
##status##: The status
##priority##: Priority of the request
##contact##: Name of the applicant
##emailupdate##: Follow-ups by email (YES/NO)
##category##: Ticket category
##content##: Contents of the request
##followup##: History of the follow-ups
##signature##: Signature of the email

Additional tags available for version 0.70.1+

##title_ticket##: Title of the Ticket
##assign##: name of the technician and the group
##link##: Link to the ticket
##filesname##: List files related to the ticket
##ticketFollowUp##: Text of the beginning of the email

##t_title_ticket##: the multilingual wording of ##title_ticket## 
##t_assign##: the multilingual wording of ##assign## 
##t_link##: the multilingual wording of ##link##
##t_author##: the multilingual wording of ##author##
##t_date##: the multilingual wording of ##date##
##t_request##: the multilingual wording of ##request##
##t_equipment##: the multilingual wording of ##equipment##
##t_status##: the multilingual wording of ##status##
##t_priority##: the multilingual wording of ##priority##
##t_contact##: the multilingual wording of ##contact##
##t_emailupdate##: the multilingual wording of ##emailupdate##
##t_category##: the multilingual wording of ##category##
##t_content##: the multilingual wording of ##content##
##t_filesname##: the multilingual wording of ##filesname##

Update to come