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
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
Use bcc to send batch emails like this:
function batch_email($recipients, $subject, $message)
{
$this->email->clear(TRUE);
$this->email->from('you@yoursite.com', 'Display Name');
$this->email->to('youremailaddress@yourserver.com');
$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
I think you are assigning all recipients in a single to method, like
$this->email->to('one@example.com, two@example.com, three@example.com');
This will mail to all recipients at once. To prevent showing all recipients, mail it separately for each user, as follows,
foreach ($list as $name => $address)
{
$this->email->clear();
$this->email->to($address);
$this->email->from('your@example.com');
$this->email->subject('Here is your info '.$name);
$this->email->message('Hi '.$name.' Here is the info you requested.');
$this->email->send();
}
Here $list
contains array of Recipient name and email ID. Make sure to use clear()
at the beginning of each iteration.