Bugfixes with missing form_type variable and wrong mail subject. Also
added proper status page after mail sending.
This commit is contained in:
parent
806d8854bc
commit
cb3d9a2792
@ -69,6 +69,7 @@ if (!$tpl_done && $sm->hasSessionToken()) {
|
|||||||
case 'send':
|
case 'send':
|
||||||
echo 'This would send the mail...';
|
echo 'This would send the mail...';
|
||||||
$mo = new MailOutput(dirname(__FILE__) . '/templates');
|
$mo = new MailOutput(dirname(__FILE__) . '/templates');
|
||||||
|
$form_type = $_REQUEST['form_type'];
|
||||||
$mo->setTemplate('mail_' . $form_type);
|
$mo->setTemplate('mail_' . $form_type);
|
||||||
$skey = 'form_' . $form_type;
|
$skey = 'form_' . $form_type;
|
||||||
$fd = new FieldDefinition($form_type);
|
$fd = new FieldDefinition($form_type);
|
||||||
@ -80,13 +81,15 @@ if (!$tpl_done && $sm->hasSessionToken()) {
|
|||||||
$data['email_date'] = date('r');
|
$data['email_date'] = date('r');
|
||||||
$data = array_merge($data, $fields);
|
$data = array_merge($data, $fields);
|
||||||
$mo->setTemplateVars($data);
|
$mo->setTemplateVars($data);
|
||||||
$mo->setSubject('[FRS] ' . $data['action_uc'] . ' Reservation');
|
$mo->setTemplateVar('form_type', $form_type);
|
||||||
|
$mo->setTemplateVar('form_type_uc', ucwords($form_type));
|
||||||
|
$mo->setSubject('[FRS] ' . ucwords($form_type) . ' Reservation');
|
||||||
$mo->addRecipient($data['user']['email'], $data['user']['name_first'] . ' ' . $data['user']['name_last']);
|
$mo->addRecipient($data['user']['email'], $data['user']['name_first'] . ' ' . $data['user']['name_last']);
|
||||||
$mail_sent = $mo->send();
|
$mail_sent = $mo->send();
|
||||||
if ($mail_sent) {
|
if ($mail_sent) {
|
||||||
echo 'Mail sent successfully.';
|
$ho->setTemplate('mail_sent_html');
|
||||||
} else {
|
} else {
|
||||||
echo 'Mail sending failed!!';
|
$ho->setTemplate('mail_failed_html');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
17
templates/mail_failed_html.mustache
Normal file
17
templates/mail_failed_html.mustache
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{> html_head}}
|
||||||
|
{{> mdl_head}}
|
||||||
|
{{> mdl_content_head}}
|
||||||
|
|
||||||
|
<div class="frs-crumbs mdl-color-text--grey-500">
|
||||||
|
<a href="./">Fake Reservation System</a> > Send Reservation
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>Mail sending FAILED</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
There was an error sending the mail.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{> mdl_content_foot}}
|
||||||
|
{{> mdl_foot}}
|
||||||
|
{{> html_foot}}
|
@ -1,5 +1,5 @@
|
|||||||
From: Fake Reservation System <{{user.email}}>
|
From: Fake Reservation System <{{user.email}}>
|
||||||
Subject: [FRS] {{action_uc}} Reservation
|
Subject: [FRS] {{form_type_uc}} Reservation
|
||||||
Date: {{email_date}}
|
Date: {{email_date}}
|
||||||
X-Mailer: FRS/1.0
|
X-Mailer: FRS/1.0
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From: Fake Reservation System <{{user.email}}>
|
From: Fake Reservation System <{{user.email}}>
|
||||||
Subject: [FRS] {{action_uc}} Reservation
|
Subject: [FRS] {{form_type_uc}} Reservation
|
||||||
Date: {{email_date}}
|
Date: {{email_date}}
|
||||||
X-Mailer: FRS/1.0
|
X-Mailer: FRS/1.0
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
@ -19,11 +19,11 @@ Content-Type: text/html; charset=utf-8
|
|||||||
<div itemprop="reservationFor" itemscope itemtype="http://schema.org/LodgingBusiness">
|
<div itemprop="reservationFor" itemscope itemtype="http://schema.org/LodgingBusiness">
|
||||||
Hotel: <span itemprop="name">{{reservationFor_name.value}}</span><br/>
|
Hotel: <span itemprop="name">{{reservationFor_name.value}}</span><br/>
|
||||||
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
|
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
|
||||||
<meta itemprop="streetAddress" content="{{reservationFor_address_streetAddress.value}}"/>
|
<span itemprop="streetAddress">{{reservationFor_address_streetAddress.value}}</span><br/>
|
||||||
<meta itemprop="addressLocality" content="{{reservationFor_address_addressLocality.value}}"/>
|
<span itemprop="addressLocality">{{reservationFor_address_addressLocality.value}}</span><br/>
|
||||||
<meta itemprop="addressRegion" content="{{reservationFor_address_addressRegion.value}}"/>
|
<span itemprop="addressRegion">{{reservationFor_address_addressRegion.value}}</span><br/>
|
||||||
<meta itemprop="postalCode" content="{{reservationFor_address_postalCode.value}}"/>
|
<span itemprop="postalCode">{{reservationFor_address_postalCode.value}}</span>
|
||||||
<meta itemprop="addressCountry" content="{{reservationFor_address_addressCountry.value}}"/>
|
<span itemprop="addressCountry">{{reservationFor_address_addressCountry.value}}</span><br/>
|
||||||
</div>
|
</div>
|
||||||
Tel.: <span itemprop="telephone">{{reservationFor_telephone.value}}</span><br/>
|
Tel.: <span itemprop="telephone">{{reservationFor_telephone.value}}</span><br/>
|
||||||
<a itemprop="url" href="{{reservationFor_url.value}}">Homepage</a><br/>
|
<a itemprop="url" href="{{reservationFor_url.value}}">Homepage</a><br/>
|
||||||
|
17
templates/mail_sent_html.mustache
Normal file
17
templates/mail_sent_html.mustache
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{> html_head}}
|
||||||
|
{{> mdl_head}}
|
||||||
|
{{> mdl_content_head}}
|
||||||
|
|
||||||
|
<div class="frs-crumbs mdl-color-text--grey-500">
|
||||||
|
<a href="./">Fake Reservation System</a> > Send Reservation
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>Mail sent</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Check your inbox.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{> mdl_content_foot}}
|
||||||
|
{{> mdl_foot}}
|
||||||
|
{{> html_foot}}
|
Reference in New Issue
Block a user