Bugfixes with missing form_type variable and wrong mail subject. Also

added proper status page after mail sending.
This commit is contained in:
Markus Birth 2016-08-02 11:54:13 +02:00
parent 806d8854bc
commit cb3d9a2792
5 changed files with 47 additions and 10 deletions

View File

@ -69,6 +69,7 @@ if (!$tpl_done && $sm->hasSessionToken()) {
case 'send':
echo 'This would send the mail...';
$mo = new MailOutput(dirname(__FILE__) . '/templates');
$form_type = $_REQUEST['form_type'];
$mo->setTemplate('mail_' . $form_type);
$skey = 'form_' . $form_type;
$fd = new FieldDefinition($form_type);
@ -80,13 +81,15 @@ if (!$tpl_done && $sm->hasSessionToken()) {
$data['email_date'] = date('r');
$data = array_merge($data, $fields);
$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']);
$mail_sent = $mo->send();
if ($mail_sent) {
echo 'Mail sent successfully.';
$ho->setTemplate('mail_sent_html');
} else {
echo 'Mail sending failed!!';
$ho->setTemplate('mail_failed_html');
}
break;
default:

View 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> &gt; Send Reservation
</div>
<h3>Mail sending FAILED</h3>
<p>
There was an error sending the mail.
</p>
{{> mdl_content_foot}}
{{> mdl_foot}}
{{> html_foot}}

View File

@ -1,5 +1,5 @@
From: Fake Reservation System <{{user.email}}>
Subject: [FRS] {{action_uc}} Reservation
Subject: [FRS] {{form_type_uc}} Reservation
Date: {{email_date}}
X-Mailer: FRS/1.0
MIME-Version: 1.0

View File

@ -1,5 +1,5 @@
From: Fake Reservation System <{{user.email}}>
Subject: [FRS] {{action_uc}} Reservation
Subject: [FRS] {{form_type_uc}} Reservation
Date: {{email_date}}
X-Mailer: FRS/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">
Hotel: <span itemprop="name">{{reservationFor_name.value}}</span><br/>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<meta itemprop="streetAddress" content="{{reservationFor_address_streetAddress.value}}"/>
<meta itemprop="addressLocality" content="{{reservationFor_address_addressLocality.value}}"/>
<meta itemprop="addressRegion" content="{{reservationFor_address_addressRegion.value}}"/>
<meta itemprop="postalCode" content="{{reservationFor_address_postalCode.value}}"/>
<meta itemprop="addressCountry" content="{{reservationFor_address_addressCountry.value}}"/>
<span itemprop="streetAddress">{{reservationFor_address_streetAddress.value}}</span><br/>
<span itemprop="addressLocality">{{reservationFor_address_addressLocality.value}}</span><br/>
<span itemprop="addressRegion">{{reservationFor_address_addressRegion.value}}</span><br/>
<span itemprop="postalCode">{{reservationFor_address_postalCode.value}}</span>
<span itemprop="addressCountry">{{reservationFor_address_addressCountry.value}}</span><br/>
</div>
Tel.: <span itemprop="telephone">{{reservationFor_telephone.value}}</span><br/>
<a itemprop="url" href="{{reservationFor_url.value}}">Homepage</a><br/>

View 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> &gt; Send Reservation
</div>
<h3>Mail sent</h3>
<p>
Check your inbox.
</p>
{{> mdl_content_foot}}
{{> mdl_foot}}
{{> html_foot}}