Adding to Giveaway and Getaway form.
using templates:
giveawayConfEmail.tpl
getawayConfEmail.tpl
}
}
+/**
+ * Emails the owner the submitted data from the submitted form
+ *
+ * Uses a flexy template to render a nice looking html email.
+ * Fills in the supplied data from the form and doesn't add the
+ * empty fields the user didn't fill in.
+ *
+ * @param string $mailFactory What type of mail factory should we use
+ *
+ * @return boolean result of the mailing
+ * @access protected
+ */
+ protected function sendConfirmation(
+ $emailSubject,
+ $emailTemplate,
+ $mailFactory = 'mail'
+ ) {
+
+ $template = new HTML_Template_Flexy($this->flexyOptions);
+ $page = new stdClass();
+ // for comments textarea need to replace newlines with br
+ $this->formData['comments']['element']
+ = nl2br($this->getSubmitValue('comments'));
+
+ $userEmail = $this->getSubmitValue('email');
+ $page->email_from = OWNER_EMAIL;
+ $page->subject = $emailSubject;
+ $page->fname = $this->getSubmitValue('fname');
+ $page->lname = $this->getSubmitValue('lname');
+
+ $template->compile($emailTemplate);
+ $htmlMsg = $template->bufferedOutputObject($page);
+
+ $msg = "{$page->subject}\n\n";
+ $msg .= "From {$page->fname} {$page->lname}\n\n";
+
+ $mimeMail = new Mail_mime("\n");
+ $mimeMail->setFrom("Gaylord Golf Mecca <".OWNER_EMAIL.">");
+ $mimeMail->setSubject($emailSubject);
+ $mimeMail->setHTMLBody($htmlMsg);
+ $mimeMail->setTXTBody($msg);
+
+ $mail =& Mail::factory($mailFactory);
+ $body = $mimeMail->get();
+ $headers = $mimeMail->headers($setHeader);
+
+ $res = $mail->send($this->email, $headers, $body);
+ if (PEAR::isError($res)) {
+ return Toolkit_Common::handleError($res);
+ } else {
+ return $res;
+ }
+ }
+
+
/**
* Display errors with the form to the user
*
if ($this->process(array(&$this, 'processData'), $this->mergeFiles)) {
$this->freeze();
$this->emailOwner();
+ if (method_exists($this, 'confirmation')) {
+ $this->confirmation();
+ }
$output = $this->successMsg;
}
$this->sent = true;
}
// }}}
+ /**
+ * confirmation
+ *
+ * Send out the Confirmation email with subject and using template
+ *
+ * @access public
+ * @return void
+ */
+ public function confirmation()
+ {
+ $this->sendConfirmation(
+ 'Gaylord Golf Giveaway', // Email Subject
+ 'giveawayConfEmail.tpl' // Email Template File
+ );
+ }
}
$this->setupElements($e);
}
+
+ /**
+ * confirmation
+ *
+ * Send out the Confirmation email with subject and using template
+ *
+ * @access public
+ * @return void
+ */
+ public function confirmation()
+ {
+ $this->sendConfirmation(
+ 'Confirmation: Gaylord. America’s Summer Golf Mecca', // Email Subject
+ 'getawayConfEmail.tpl' // Email Template File
+ );
+ }
// }}}
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>{title:h}</title>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ <title>{title:h}</title>
</head>
<body>
- <!-- {{{ body -->
- <p>
- <font size="4" face="arial, sans-serif">
- <b>{subject:h}</b>
- </font>
- </p>
- <p>
- <font size="3" face="arial, sans-serif">
- <b>From {fname:h} {lname:h}</b>
- </font>
- </p>
- <table cellspacing="0" cellpadding="0" bgcolor="#c0c0c0" border="0">
- <tr>
- <td>
- <table cellspacing="1" cellpadding="5" border="0" bgcolor="#c0c0c0" width="400">
- {foreach:formData,v}
- <tr flexy:if="v[element]" bgcolor="#c0c0c0">
- <td align="right" bgcolor="#ffffff">
- <font size="2" face="arial, sans-serif">
- <b>{v[label]:h}</b>
- </font>
- </td>
- {if:v[nowrap]}
- <td nowrap bgcolor="#ffffff">
- <font size="2" face="arial, sans-serif">{v[element]:h}</font>
- </td>
- {else:}
- <td bgcolor="#ffffff">
- <font size="2" face="arial, sans-serif">{v[element]:h}</font>
- </td>
- {end:}
- </tr>
- {end:}
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <table cellspacing="0" cellpadding="10" border="0" width="400">
- <tr>
- <td bgcolor="#eeeeee">
- <font size="1" face="arial, sans-serif">
- To ensure the delivery of these e-mails to your inbox, please add {email_from:h} to your e-mail Address Book or Safe List.
- </font>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- </table>
- <!-- }}} -->
+ <!-- {{{ body -->
+ <p>
+ <font size="4" face="arial, sans-serif">
+ <b>{subject:h}</b>
+ </font>
+ </p>
+ <p>
+ <font size="3" face="arial, sans-serif">
+ <b>From {fname:h} {lname:h}</b>
+ </font>
+ </p>
+ <table cellspacing="0" cellpadding="0" bgcolor="#c0c0c0" border="0">
+ <tr>
+ <td>
+ <table cellspacing="1" cellpadding="5" border="0" bgcolor="#c0c0c0" width="400">
+ {foreach:formData,v}
+ <tr flexy:if="v[element]" bgcolor="#c0c0c0">
+ <td align="right" bgcolor="#ffffff">
+ <font size="2" face="arial, sans-serif">
+ <b>{v[label]:h}</b>
+ </font>
+ </td>
+ {if:v[nowrap]}
+ <td nowrap bgcolor="#ffffff">
+ <font size="2" face="arial, sans-serif">{v[element]:h}</font>
+ </td>
+ {else:}
+ <td bgcolor="#ffffff">
+ <font size="2" face="arial, sans-serif">{v[element]:h}</font>
+ </td>
+ {end:}
+ </tr>
+ {end:}
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellspacing="0" cellpadding="10" border="0" width="400">
+ <tr>
+ <td bgcolor="#eeeeee">
+ <font size="1" face="arial, sans-serif">
+ To ensure the delivery of these e-mails to your inbox, please add {email_from:h} to your e-mail Address Book or Safe List.
+ </font>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ </table>
+ <!-- }}} -->
</body>
</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ <title>{title:h}</title>
+</head>
+<body>
+ <!-- {{{ body -->
+ <p>
+ <font size="4" face="arial, sans-serif">
+ <b>{subject:h}</b>
+ </font>
+ </p>
+ <table cellspacing="0" cellpadding="0" bgcolor="#c0c0c0" border="0">
+ <tr>
+ <td>
+ <p>Thank you for entering the Gaylord America's Summer Golf Mecca's \"Great Big Gaylord Golf Getaway!</p>
+ <p>If you would like additional information on Golf in the Gaylord Area please visit
+ <a href="http://www.gaylordgolfmecca.com">www.gaylordgolfmecca.com</a></p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellspacing="0" cellpadding="10" border="0" width="400">
+ <tr>
+ <td bgcolor="#eeeeee">
+ <font size="1" face="arial, sans-serif">
+ To ensure the delivery of these e-mails to your inbox,
+ please add {email_from:h} to your e-mail Address Book or Safe List.
+ </font>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <!-- }}} -->
+</body>
+</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ <title>{title:h}</title>
+</head>
+<body>
+ <!-- {{{ body -->
+ <p>
+ <font size="4" face="arial, sans-serif">
+ <b>{subject:h}</b>
+ </font>
+ </p>
+ <table cellspacing="0" cellpadding="0" bgcolor="#c0c0c0" border="0">
+ <tr>
+ <td>
+ <p>Thank you for entering to win a FREE 4 Nights/4 Days (6 rounds) GOLF PACKAGE to the Gaylord Golf Mecca!</p>
+ <p>This is a confirmation of your entry in the Gaylord Golf Giveaway</p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellspacing="0" cellpadding="10" border="0" width="400">
+ <tr>
+ <td bgcolor="#eeeeee">
+ <font size="1" face="arial, sans-serif">
+ To ensure the delivery of these e-mails to your inbox,
+ please add {email_from:h} to your e-mail Address Book or Safe List.
+ </font>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <!-- }}} -->
+</body>
+</html>