c13
c13

Reputation: 9

Need a guide insert this custom php send mail to codeigniter

I would like to asking about insert this php send mail to my CodeIgniter but im totally green in CI The problem, i want to save data (this is succes) and continue send email (problem).

here the example,

/controller/tracker.php

{
    $data = array(
    'issue_title'               => $this->input->post('trackertitle'),
    'issue_tracker'             => $this->input->post('issuetracker'),
    'issue_code'                => $this->input->post('trackercode'),
    'issue_create_date'         => $this->input->post('trackercreatedate'),
    'issue_start_date'          => $this->input->post('trackerstartdate'),
    'issue_finish_date'         => $this->input->post('trackerfinishdate'),
    'issue_description'         => $this->input->post('trackerdescription'),
    'issue_assignee'            => $this->input->post('trackerassignee'),
    'issue_status'              => $this->input->post('trackerstatus'),
    'issue_origin'              => $this->input->post('trackerorigin'),
    'issue_watcher'             => implode(",",$_POST['trackerwatcher']),
    );
    $this->Tracker_model->create_new($data);
    $this->session->set_flashdata('message', 'One data added.');
    redirect('tracker');
    }

I need to insert this php code inside that tracker.php

$to = $_POST['toemail'];
$trackertitle = $_POST['trackertitle'];
$message = $_POST['trackerdescription'];
$fromemail = $_POST['fromemail'];
$fromname = $_POST['fromname'];
$lt= '<';
$gt= '>';
$sp= ' ';
$from= 'From:';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= $from.$fromname.$sp.$lt.$fromemail.$gt;
//$headers .= "\r\nCc: [email protected]";    
mail($to,$subject,$message,$headers);

half code from page /view/tracker_addform.php . I want to keep that value as number

<div class="col-sm-12">
<label>Watcher</label><br>
<input type="checkbox" name="trackerwatcher[]" value="1"> People 1 <input type="checkbox" name="trackerwatcher[]" value="2" > People 2 <input type="checkbox" name="trackerwatcher[]" value="3" > People 3 
</div>

For clear information,

  1. Email will be send to checked people, if not checked email will not send to that people
  2. Submitted data from /view/tracker_addform.php , the /controller/tracker.php process to save data and continue send email from checked people

I would greatly appreciate it if you kindly give me some feedback or guide.

Upvotes: 0

Views: 153

Answers (1)

mdgeus
mdgeus

Reputation: 382

Why don't you use the CI email class? http://www.codeigniter.com/userguide2/libraries/email.html

It's easy to setup and works like a charm ;)

Upvotes: 0

Related Questions