Welcome Guest, Not a member yet? Register   Sign In
$this->email->clear() does not clear BCC array
#1

[eluser]Vince Stross[/eluser]
Hopefully I haven't missed this as being reported already (I promise I searched first and checked the Bug Tracker!)

When sending multiple emails, if the first email specifies a value for BCC, calling the clear() function does not clear the _bcc_array in the Email class.

Code:
// First Message
$this->email->to('[email protected]');
$this->email->bcc('[email protected]');
$this->email->from('[email protected]');
$this->email->subject('This is the first message');
$this->email->message(' ... ');

$this->email->send();

// Second Message
$this->email->clear();

$this->email->to('[email protected]');
$this->email->from('[email protected]');
$this->email->subject('This is the second message');
$this->email->message(' ... ');

$this->email->send();

The second message will be sent to the BCC address as well. I checked the clear() method of the Email class and I can't see where the _bcc_array is being cleared.

It's an easy workaround for now:

Code:
// Second Message
$this->email->clear();
$this->email->_bcc_array = array(); // Simply clear the array manually

$this->email->to('[email protected]');
$this->email->from('[email protected]');
$this->email->subject('This is the second message');
$this->email->message(' ... ');

$this->email->send();
#2

[eluser]jeffpeck[/eluser]
In the Email class, it appears to not clear the _recipients, _cc_array, and _bcc_array... This seems to be a bug, although I am curious if there is an explanation for why it was written this way.
#3

[eluser]sophistry[/eluser]
so you got caught by this bug too, huh? it's been in the bug tracker for about 9 months now!

http://codeigniter.com/bug_tracker/bug/7826/

really, really, overlooked in all the bug fixing that's been going on. i tried shaking the tree in January... see my comments on the bug.

it's pretty annoying to report bugs and have them ignored - hope you don't get disappointed.

best bet, PM one of the dereks.




Theme © iAndrew 2016 - Forum software by © MyBB