From b901e736a811907cea99dda9d06f656f526f5090 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:44:57 +0100 Subject: After sending an email clear the parameters --- system/libraries/Email.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index fdb9be4da..9d80f0720 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1257,11 +1257,15 @@ class CI_Email { if ($this->bcc_batch_mode && count($this->_bcc_array) > $this->bcc_batch_size) { - return $this->batch_bcc_send(); + $result = $this->batch_bcc_send(); + $this->clear(); + return $result; } $this->_build_message(); - return $this->_spool_email(); + $result = $this->_spool_email(); + $this->clear(); + return $result; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From d7bc8d04e5c13bbafe3bf10ca2634c1f8481ed53 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:46:20 +0100 Subject: New parameter to automatically clear the parameters --- system/libraries/Email.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 9d80f0720..8239862a9 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1238,7 +1238,7 @@ class CI_Email { * * @return bool */ - public function send() + public function send($auto_clear = TRUE) { if ($this->_replyto_flag === FALSE) { @@ -1258,13 +1258,23 @@ class CI_Email { if ($this->bcc_batch_mode && count($this->_bcc_array) > $this->bcc_batch_size) { $result = $this->batch_bcc_send(); - $this->clear(); + + if ($auto_clear) + { + $this->clear(); + } + return $result; } $this->_build_message(); $result = $this->_spool_email(); - $this->clear(); + + if ($auto_clear) + { + $this->clear(); + } + return $result; } -- cgit v1.2.3-24-g4f1b From a87aab39488367c18b9e60d2020665b17b35f4b1 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:50:37 +0100 Subject: Only clear if request was successful --- system/libraries/Email.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 8239862a9..196a4b36c 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1259,7 +1259,7 @@ class CI_Email { { $result = $this->batch_bcc_send(); - if ($auto_clear) + if ($result && $auto_clear) { $this->clear(); } @@ -1270,11 +1270,11 @@ class CI_Email { $this->_build_message(); $result = $this->_spool_email(); - if ($auto_clear) + if ($result && $auto_clear) { $this->clear(); } - + return $result; } -- cgit v1.2.3-24-g4f1b From a473d8009e5ef2043f1570acf632f3b1a1253ed0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:51:04 +0100 Subject: Updated email library documentation --- user_guide_src/source/libraries/email.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index c5fa68004..f56bc2ff5 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -226,6 +226,14 @@ success or failure, enabling it to be used conditionally:: // Generate error } +This function will automatically clear all parameters if the request was + successful. To stop this behaviour pass FALSE:: + + if ($this->email->send(FALSE)) + { + // Parameters won't be cleared + } + $this->email->attach() ---------------------- -- cgit v1.2.3-24-g4f1b From 5f441eaedf5fecbad29131c5d44e3c2d53c4c4b5 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:53:14 +0100 Subject: Updated changelog --- user_guide_src/source/changelog.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 7f428e5db..4d69c4dc3 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -176,7 +176,9 @@ Release Date: Not Released - Allowed for setting table class defaults in a config file. - Added a Wincache driver to the :doc:`Caching Library `. - Added a Redis driver to the :doc:`Caching Library `. - - Added dsn (delivery status notification) option to the :doc:`Email Library `. + - :doc:`Email library ` changes include: + - Added dsn (delivery status notification) option. + - Successfully sent emails will automatically clear the parameters. - Renamed method _set_header() to set_header() and made it public to enable adding custom headers in the :doc:`Email Library `. - Added an "index" parameter to the data() method in the :doc:`Upload Library `. - :doc:`Pagination Library ` changes include: -- cgit v1.2.3-24-g4f1b