How to setup an email template for all emails sent to trainees
Un article de EpistemaWiki.
Introduction
All the emails sent to trainees from the application can be wrapped into an HTML template, weither the email is in text or HTML.
Configuration
In order to setup the template, a configuration variable must be set, with the name of the HTML file to use:
$GLOBALS['conf']['MailingHTMLTemplate'] = 'template.html';
HTML Template
The template is an HTML file that must be placed in the data/mailing_template/ folder of the application. The file can refer to images, that should be stored in the same folders. Keep in mind that complex CSS is not always properly rendered in most email readers, so the layout should be kept conservative.
The email charset should be utf-8 (as follow), and it should not be linked to any external css file.
The only keyword should be {content}, that will be eventually replaced with the text of the email.
Here's an example of an HTML template:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body { margin: 0; font-family: Verdana, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif; background-color: #FFFFFF}
p, td, th { font-size: 11px; }
-->
</style>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="5" width="500">
<tbody>
<tr>
<td><img name="barre" src="barre.gif" width="500" height="38" border="0"><br><br><br></td>
</tr>
<tr>
<td>{content}</td>
</tr>
<tr>
<td>
<font size="1" color="#555555"><br><br>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus tempus....
</font>
</td>
</tr>
</tbody>
</table>
</body>
</html>
