summaryrefslogtreecommitdiffstats
path: root/system/libraries/Email.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-11-24 18:36:28 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-11-24 18:36:28 +0100
commite101593561a10632c1d63180436b19f1d7115046 (patch)
treed88c03d6d1479231defb2e82582c0ceb0ebf98c9 /system/libraries/Email.php
parentc72e172f158747b75ee524b46f5819c4bf3d0eaa (diff)
parente3d60b8880abb09555509e650aafe07136d1adee (diff)
Merge pull request #704 from bitrayne/develop
Allow a custom file name for email attachments.
Diffstat (limited to 'system/libraries/Email.php')
-rw-r--r--system/libraries/Email.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 7bde4c4fd..631b62e86 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -418,11 +418,11 @@ class CI_Email {
* @param string
* @return void
*/
- public function attach($filename, $disposition = 'attachment')
+ public function attach($filename, $disposition = '', $newname = NULL)
{
- $this->_attach_name[] = $filename;
+ $this->_attach_name[] = array($filename, $newname);
$this->_attach_type[] = $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION));
- $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters
+ $this->_attach_disp[] = empty($disposition) ? 'attachment' : $disposition; // Can also be 'inline' Not sure if it matters
return $this;
}
@@ -1151,8 +1151,9 @@ class CI_Email {
for ($i=0; $i < count($this->_attach_name); $i++)
{
- $filename = $this->_attach_name[$i];
- $basename = basename($filename);
+ $filename = $this->_attach_name[$i][0];
+ $basename = ( is_null($this->_attach_name[$i][1]) ? basename($filename) : $this->_attach_name[$i][1] );
+
$ctype = $this->_attach_type[$i];
if ( ! file_exists($filename))