Skip to content

Instantly share code, notes, and snippets.

@frederickding
Created December 7, 2013 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frederickding/7837728 to your computer and use it in GitHub Desktop.
Save frederickding/7837728 to your computer and use it in GitHub Desktop.
mail_helper.php patch to use CodeIgniter email library
diff --git a/OpenVBX/helpers/mail_helper.php b/OpenVBX/helpers/mail_helper.php
index 9453556..50efff0 100644
--- a/OpenVBX/helpers/mail_helper.php
+++ b/OpenVBX/helpers/mail_helper.php
@@ -30,13 +30,17 @@ function openvbx_mail($recipient, $subject, $template, $maildata = array())
$from_email = "$from <do-not-reply@$domain>";
}
- $headers = 'From: '.$from_email."\r\n";
- $headers .= 'Reply-To: '.$from_email."\r\n";
- $headers .= 'Return-Path: '.$from_email."\r\n";
- $headers .= 'User-Agent: OpenVBX-'.OpenVBX::version();
-
$message = $ci->load->view('emails/'.$template, $maildata, true);
-
+
+ $ci->load->library('email');
+ $ci->email->clear();
+ $ci->email->from($from_email);
+ $ci->email->reply_to($from_email);
+ $ci->email->to($recipient);
+ $ci->email->subject($subject);
+ $ci->email->message($message);
+
log_message('debug', 'MAILING -- to: '.$recipient.' -- body: '.$message);
- return mail($recipient, '[OpenVBX] '.$subject, $message, $headers);
-}
\ No newline at end of file
+
+ return $ci->email->send();
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment