Welcome Guest, Not a member yet? Register   Sign In
Code Ingiter Email class not sending emails - MAIL at same spot does
#1

[eluser]kaosweaver[/eluser]
Hello all,
I've got a weird issue - the code was, at one time working. I've since upgraded to the latest version (2.1.0) and I'm not sure if that introduced an error or I'm just blind and missing something. I've put in debugs and setup a PHP mail to test the server's email and the code igniter's code. Here is the relevant code:

Code:
if (count($members_array)>0) {
    $this->Course->group_assign_courses($this->input->post('course_id'),$members_array,$due_date);
    
    $course=$this->Course->get_course_by_id($this->input->post('course_id'));
    $this->load->library('email');
    $this->load->helper('email');
    $this->load->model('Emails_mdl');
    
    $emailz=$this->Emails_mdl->get_email_by_id(1);
    $config['mailtype'] = "html";
    $this->email->initialize($config);

    foreach($members_array as $staff) {
     $this->email->from($this->config->item('system_email'), 'Support Email');
     log_message('debug','**********FROM:'.$this->config->item('system_email'));
     $this->email->subject($emailz->title);
     log_message('debug','**********SUBJECT:'.$emailz->title);
     $member=$this->Members->get_member($staff);
     $this->email->to($member->login);
     log_message('debug','**********TO:'.$member->login);
     $data= array(
      "first_name"=>$member->first_name,
      "last_name"=>$member->last_name,
      "login"=>$member->login,
      "password"=>$member->password,
      "course"=>$course->title,
      "url"=>$this->config->item('base_url'),
      "due_date"=>($this->input->post('due_date'))?$this->input->post('due_date'):"open"
     );
     $message=email_data($emailz->email_copy,$data);
     log_message('debug','**********MESSAGE:'.$message);
     $this->email->message($message);
     $this->email->send();
     mail($member->login,$emailz->title,$message);
     $this->email->clear();
    }
   }

Here are the lines from debug:

Code:
DEBUG - 2011-11-21 09:55:46 --> **********FROM:[email protected]
DEBUG - 2011-11-21 09:55:46 --> **********SUBJECT:Academy-Course Assigned to You
DEBUG - 2011-11-21 09:55:46 --> **********TO:[email protected]
DEBUG - 2011-11-21 09:55:46 --&gt; **********MESSAGE:<p>
Hello Paul Kaos,</p>
<p>
You have been assigned the course: Basic Registration through Service Recording</p>
<p>&nbsp;
</p>
<p>
The due date for the course is 12/05/2011</p>
<p>
Please login here to access the course: http://www.clientdomain.com/<br />
<br />
Login: [email protected]<br />
Password: 1234</p>
<p>&nbsp;
</p>
<p>
Thank you,<br />
Customer Service</p>

The Code Igniter email line doesn't send, the MAIL line does (take it out, get no emails, put it in, get one) - can someone show me what I'm missing




Theme © iAndrew 2016 - Forum software by © MyBB