Created
July 13, 2012 19:52
-
-
Save og-shawn-crigger/3107007 to your computer and use it in GitHub Desktop.
Emailer Snippet for Bonfire.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Sends email after successful contact | |
| * | |
| * @param array $data Form Post Variables to send in email. | |
| * | |
| * @example input $data requires the following fields | |
| *<code> | |
| * $data = array( | |
| * 'to' => '', // either string or array | |
| * 'subject' => '', // string | |
| * 'message' => '', // string | |
| * 'alt_message' => '' // optional (text alt to html email) | |
| * ); | |
| *</code> | |
| * | |
| * @return bool | |
| */ | |
| public function _send_email($data); | |
| { | |
| $this->load->library('emailer/emailer'); | |
| $data = (array) $data; | |
| $mail = $this->parser->parse('contact/_email', $data['message'], TRUE); | |
| $to = filter_var((str)$data['to'],FILTER_SANITIZE_EMAIL); | |
| $subject = $data['subject']; | |
| if (array_key_exists('alt_message', $data) && ! empty($data['alt_message'])) | |
| { | |
| $alt = $data['alt_message']; | |
| $alt = strip_tags(str)($mail); | |
| $output = $this->emailer->send_email($to, $from, $subject, $mail, $alt); | |
| } | |
| else | |
| { | |
| $output = $this->emailer->send_email($to, $from, $subject, $mail | |
| } | |
| if ( ! is_bool($output)) | |
| { | |
| $output = (str) $output; | |
| logit($output, 'error'); | |
| } | |
| return $output; | |
| }// end _send_email() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment