Reputation: 6085
Hi friends i am creating newsletter in codeigniter. Is there a way to send multiple email with CI email lib or should i use third party ?
Upvotes: 2
Views: 21643
Reputation: 971
Straight from the manual…
$this->email->to()
Sets the email address(s) of the recipient(s). Can be a single email, a comma-delimited list or an array:
$this->email->to('[email protected]');
$this->email->to('[email protected], [email protected], [email protected]');
$list = array('[email protected]', '[email protected]', '[email protected]');
$this->email->to($list);
Upvotes: 5
Reputation: 17967
Using the Email Class, something like:
foreach ($list as $name => $address)
{
$this->email->clear();
$this->email->to($address);
$this->email->from('[email protected]');
$this->email->subject('Here is your info '.$name);
$this->email->message('Hi '.$name.' Here is the info you requested.');
$this->email->send();
}
would work. (Straight from the docs). It depends on how many addresses you have, and any constraints such as server/mail queue processing/script time out etc
I'm not personally aware of a 3rd party CI newsletter plugin/library but i haven't looked too hard.
Upvotes: 12