Created
          December 7, 2013 05:51 
        
      - 
      
- 
        Save frederickding/7837728 to your computer and use it in GitHub Desktop. 
    mail_helper.php patch to use CodeIgniter email library
  
        
  
    
      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
    
  
  
    
  | 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