summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatteo Mattei <matteo.mattei@gmail.com>2012-03-15 16:03:58 +0100
committerMatteo Mattei <matteo.mattei@gmail.com>2012-03-15 16:03:58 +0100
commitdf59c687a2243142e6da9d7b904523a1b91ca09b (patch)
tree49822495cd84ac837c1205b69c9eba37b476c3f2
parent5a98a3dda56f6167f8241a7bc7d1c8784d98ccf9 (diff)
Email class: adjust documentation and make the code backward compatible
-rw-r--r--system/libraries/Email.php4
-rw-r--r--user_guide_src/source/libraries/email.rst15
2 files changed, 9 insertions, 10 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index df03eaaf6..7320ea566 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -408,10 +408,10 @@ class CI_Email {
* @param string
* @return object
*/
- public function attach($filename, $str = '', $mime = '', $disposition = '', $newname = NULL)
+ public function attach($filename, $disposition = '', $str = '', $mime = '', $newname = NULL)
{
$this->_attach_name[] = array($filename, $newname);
- $this->_attach_type[] = ($mime === '') ? $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION)) : $mime;
+ $this->_attach_type[] = ($mime == '') ? $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION)) : $mime;
$this->_attach_disp[] = empty($disposition) ? 'attachment' : $disposition; // Can also be 'inline' Not sure if it matters
$this->_attach_content[] = $str;
return $this;
diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst
index d05439a77..2be50fd35 100644
--- a/user_guide_src/source/libraries/email.rst
+++ b/user_guide_src/source/libraries/email.rst
@@ -228,19 +228,18 @@ use the function multiple times. For example::
$this->email->attach('/path/to/photo2.jpg');
$this->email->attach('/path/to/photo3.jpg');
-$filename, $str = '', $mime = '', $disposition = '', $newname = NULL
+To use the default disposition (attachment), leave the second parameter blank.
If you need to use a buffer string instead of a real (physical) file you can use the
-second and third parameters that are respectively the buffer and the mime-type::
+third and fourth parameters that are respectively the buffer and the mime-type::
- $this->email->attach('report.pdf', $buffer, 'application/pdf');
+ $this->email->attach('report.pdf', 'inline', $buffer, 'application/pdf');
-If you'd like to change the disposition or add a custom file name, you can use the
-fourth and fifth paramaters. To use the default disposition (attachment), leave the
-fourth parameter blank. Here's an example::
+If you'd like to add a custom file name, you can use the fifth paramaters.
+Here's an example::
- $this->email->attach('/path/to/photo1.jpg', '', '', 'inline');
+ $this->email->attach('/path/to/photo1.jpg', '', '', '', 'inline');
$this->email->attach('/path/to/photo1.jpg', '', '', '', 'birthday.jpg');
-
+
$this->email->print_debugger()
-------------------------------