Sending multiple email with codeigniter

Nabil Lemsieh picture Nabil Lemsieh · Jul 15, 2013 · Viewed 18.6k times · Source

I'm using Codeigniter 2 for my website. When send email to multiple users , on client( gmail, hotmail,..) it shows all addresse on details , how can i hide the addresses to show just the receiver address.

Thanks

Answer

whispersan picture whispersan · Jul 22, 2013

Use bcc to send batch emails like this:

function batch_email($recipients, $subject, $message) 
{
  $this->email->clear(TRUE);
  $this->email->from('[email protected]', 'Display Name'); 
  $this->email->to('[email protected]');
  $this->email->bcc($recipients);
  $this->email->subject($subject);
  $this->email->message($message);  

  $this->email->send();

    return TRUE;

}

$recipients should be a comma-delimited list or an array

It means that you will get a copy of the email but all other recipients will be bcc'ed, so won't see each other's addresses