CI_Email::clear()

clear([$clear_attachments = FALSE])

Parameters:
  • $clear_attachments (bool) – Whether or not to clear attachments
Returns:

CI_Email instance (method chaining)

Return type:

CI_Email

Initializes all the email variables to an empty state. This method is intended for use if you run the email sending method in a loop, permitting the data to be reset between cycles.

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();
}

If you set the parameter to TRUE any attachments will be cleared as well:

$this->email->clear(TRUE);
doc_CodeIgniter
2016-10-15 16:31:29
Comments
Leave a Comment

Please login to continue.