Welcome Guest, Not a member yet? Register   Sign In
Send Separate Emails Simultaneously


First post on here - hopefully someone can help Smile

Using Codeigniter 3, I have a web form that sends an email to the site admin once a form is submitted - this works as expected.

I am using email templates, once the form is submitted template 1 is sent (to the site admin). I would now like to simultaneously send template 2 (to the submitter's email address).

The emails will contain the same content apart from the email intro text, and subject - details below;

Email Template 1 - to admin;
'Hi, a new item has been requested on the site, ...'

Email Template 2 - to submitter;
'Hi, Here is the item you have requested on the site, ...'

My current code is as follows;

public function sendRequest() {


   $from_email     = $this->input->post('email');
   $to_email       = '[email protected]';
   $subject        = 'New Item Request - Admin Copy';
   $name           = $this->input->post('name');
   $comment        = $this->input->post('comment');


   $data = array(
       'name'          =>  $name,
       'from'          =>  $from_email,
       'comment'       =>  $comment,
   // send email template 1
   $this->email->message($this->load->view('template/email/item_request_template', $data, true));

  // send email template 2 to submitter - how?
  // change $subject to 'New Item Request - User Copy';

   if($this->email->send()) {
       // send the $data to my email template
       $data = array(
        'item_request_name'    => $this->input->post('name'),
        'item_request_email'   => $this->input->post('email'),
        'item_request_comment' => $this->input->post('comment'),

Not sure what I need to add in order to send the second email template?

Any help would be appreciated.

Messages In This Thread
Send Separate Emails Simultaneously - by johnny_s - 06-20-2017, 03:46 AM

Theme © iAndrew 2016 - Forum software by © MyBB