Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending multiple email with codeigniter

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

like image 588
Nabil Lemsieh Avatar asked Jul 15 '13 13:07

Nabil Lemsieh


1 Answers

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

like image 98
whispersan Avatar answered Oct 14 '22 09:10

whispersan