diff --git a/index.php b/index.php
index 7003053..c93cec5 100644
--- a/index.php
+++ b/index.php
@@ -97,6 +97,13 @@ if (!$tpl_done && isset($_SESSION['access_token']) && $_SESSION['access_token'])
switch ($_GET['action']) {
case 'send':
echo "This would send the mail...";
+ $mtpl = $m->loadTemplate('mail_' . $form_type);
+ $action = $form_type;
+ require 'prep_mail.php';
+ $data['action'] = $action;
+ $mail_html = $mtpl->render($data);
+ echo '
'.$mail_html;
+
break;
case 'event':
$tpl = $m->loadTemplate('event_html');
diff --git a/prep_mail.php b/prep_mail.php
new file mode 100644
index 0000000..a7b8a04
--- /dev/null
+++ b/prep_mail.php
@@ -0,0 +1,46 @@
+$meta) {
+ $meta['field_id'] = $key;
+
+ // Assign session value if set, or use default if set
+ if (isset($_SESSION[$skey][$key])) {
+ $meta['value'] = $_SESSION[$skey][$key];
+
+ switch ($meta['type']) {
+ case 'datetime':
+ $meta['value_unixtime'] = strtotime($meta['value']);
+ break;
+ }
+ }
+
+ // Field type marker for Mustache
+ $meta['fieldtype_' . $meta['type']] = true;
+
+ // Add useful default values for some types
+ if ($meta['type'] == 'datetime') {
+ $meta['today'] = date('Y-m-d');
+ }
+
+ // Add to fieldlist
+ $fields[$key] = $meta;
+}
+
+if ($debug) {
+ print_r($fields);
+}
+
+$data = array_merge($data, $fields);
diff --git a/templates/mail_hotel.mustache b/templates/mail_hotel.mustache
new file mode 100644
index 0000000..0c369e6
--- /dev/null
+++ b/templates/mail_hotel.mustache
@@ -0,0 +1,3 @@
+This is the Template for the {{action}} Mail!
+
+{{reservationFor_name.value}}