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

You could have something like this

PHP Code:
public function sendRequest() {

 
  $this->load->library('email');

 
  $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');

 
  $this->email->from($from_email);
 
  $this->email->to($to_email);
 
  $this->email->subject($subject);

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

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

 
  if($this->email->send()) {
 
      
       $this
->email->clear(TRUE); // Pass TRUE as an argument if you are sending attachments

 
      $this->email->from($from_email); // Update for second email
 
      $this->email->to($to_email); // Update for second email
 
      $this->email->subject($subject); // Update for second email
 
      
       
// 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'),
 
       );

 
      $this->email->message($this->load->view('template/email/item_request_template_2'$datatrue));

 
      $this->email->send();
 
  }


You simply have to repeat all the steps required for sending an email in the first place. Only difference is that for the second call you need to call
PHP Code:
$this->email->clear(); 

And reset all the required config options

Hope this helps you on your way Smile
Reply


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



Theme © iAndrew 2016 - Forum software by © MyBB