<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Example</title><link>https://sourceforge.net/p/phmte/wiki/Example/</link><description>Recent changes to Example</description><atom:link href="https://sourceforge.net/p/phmte/wiki/Example/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 04 Sep 2011 07:40:58 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/phmte/wiki/Example/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Example modified by Mario Trojan</title><link>https://sourceforge.net/p/phmte/wiki/Example/</link><description># Example Page #
## HTML Template ##




	&lt;!-- All "mailvar"- and "mailval"-elements in this document will be replaced --&gt;
	&lt;mail&gt;
		&lt;!-- Subject and mail headers can be set here. 
			Variables can also be used to fill headers! --&gt;
		&lt;mailfields&gt;
			&lt;subject&gt;New Order: &lt;mailvar key="OrderNumber" /&gt;&lt;/subject&gt;
			&lt;to&gt;&lt;mailvar key="Receiver" /&gt;&lt;/to&gt;
			&lt;cc&gt;&lt;mailvar key="Receiver" /&gt;&lt;/cc&gt;
		&lt;/mailfields&gt;
		&lt;mailbody&gt;
			&lt;!-- put html mail contents here --&gt;
			&lt;html&gt;
				&lt;head&gt;
					&lt;style type="text/css"&gt;
						body {
							font-family: Verdana;
							color: #0000AA;
						}
						
						div#clickme {
							color: #FFFFFF;
							background-color: #0000AA;
						}
					&lt;/style&gt;
					
					&lt;!-- this works only if javascript is allowed in receiver's mail client --&gt;
					&lt;script type="text/javascript"&gt;
						function ShowHide () {
							var element = document.getElementById('ShowHide');
							if (element.style.display == 'none') {
								element.style.display = 'block';
							}
							else {
								element.style.display = 'none';
							}
						}
					&lt;/script&gt;
				&lt;/head&gt;
				&lt;body&gt;
					&lt;!-- example for a simple string --&gt;
					&lt;h1&gt;&lt;mailvar key="Headline1" /&gt;&lt;/h1&gt;
					&lt;p&gt;This Mail belongs to Order &lt;mailvar key="OrderNumber" /&gt;&lt;/p&gt;
					&lt;div id="clickme" onclick="ShowHide();"&gt;
						Click Me!
					&lt;/div&gt;
					&lt;div id="ShowHide"&gt;
						This div will be hidden if mail client allows javascript
					&lt;/div&gt;
					
					&lt;p&gt;
						The following documents belong to this order:
					&lt;/p&gt;
					&lt;table&gt;
						&lt;tr&gt;&lt;th&gt;Document number&lt;/th&gt;&lt;th&gt;Document title&lt;/th&gt;&lt;/tr&gt;
						&lt;!-- example for a html table filled from an associative array --&gt;
						&lt;mailvar key="Documents" type="array" &gt;
							&lt;tr&gt;&lt;td&gt;&lt;mailval index="DocumentNumber" /&gt;&lt;/td&gt;&lt;td&gt;&lt;mailval index="DocumentTitle" /&gt;&lt;/td&gt;&lt;/tr&gt;
						&lt;/mailvar&gt;
					&lt;/table&gt;
				&lt;/body&gt;
			&lt;/html&gt;
		&lt;/mailbody&gt;
	&lt;/mail&gt;



## PHP Usage ##





	&lt;?php
		
		// Common PHP settings
		date_default_timezone_set('Europe/Berlin');
		
		ini_set('error_reporting', E_ALL);
		ini_set('display_errors', 1);
		
		$mail_address = 'john@doe.org';
		ini_set('sendmail_from', $mail_address);
		
		
		// Require our libs
		require_once('../../phmte.php');
		
		// Init a new Template object with a path to the template
		$tpl_path	= 'template.html';
		$tpl		= new HTMLMailTemplate($tpl_path);
		
		// Generate a new TemplateInformation object, where the Variables will be stored
		// Several additional engine settings can also be set here, like charset and content-type of the mail, or tagnames inside the template file.
		$params		= new HTMLMailTemplateInformation();
		$params-&gt;vars = array(	'OrderNumber' =&gt; 'TST0012345',
								'Headline1' =&gt; 'The Order has been generated',
								'Receiver' =&gt; $mail_address,
								'Documents' =&gt; array(
													array('DocumentTitle' =&gt; 'Document 1', 'DocumentNumber' =&gt; '1234567890'),
													array('DocumentTitle' =&gt; 'Document 2', 'DocumentNumber' =&gt; '0987654321')
												)
							);
		
		// Tell the engine to fill the template with these params
		$tpl-&gt;FillTemplate($params);
		
		// Get the prepared mail and send it
		$mail = $tpl-&gt;GetMail();
		#print nl2br(print_r($mail,true));
		$mail-&gt;Send();
		
		print "Mail successfully sent.";
		
	?&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mario Trojan</dc:creator><pubDate>Sun, 04 Sep 2011 07:40:58 -0000</pubDate><guid>https://sourceforge.netb654548c505890209b9b8099756da466d07b08a0</guid></item></channel></rss>