summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorRobert Angyal <robertonline.81@gmail.com>2016-05-04 16:33:25 +0200
committerRobert Angyal <robertonline.81@gmail.com>2016-05-04 16:33:25 +0200
commit5277583e7336675d02665ff77359b41e782853ce (patch)
tree75a7bcd290266e3d741681acfead59595f7df18f /system
parented458fbdb36f8d8d7bd7d818dbb2983485e86b3c (diff)
#4583 Refactor according to the suggestions commented on Pull Request
Signed-off-by: Robert Angyal <robertonline.81@gmail.com>
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Email.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index e35c48ec4..4fd1107c5 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1404,20 +1404,17 @@ class CI_Email {
.$this->newline
.$this->_body.$this->newline.$this->newline;
- $attachment_prepared = $this->_prep_attachments($this->_attachments, $this->_atc_boundary);
+ $body .= $this->_prep_attachments($this->_attachments, $this->_atc_boundary);
break;
case 'html-attach' :
$attachments_indexed_by_multipart = $this->_attachments_indexed_by_multipart();
- $prepared_attachment_parts = array();
$last_boundary = NULL;
if ( ! empty($attachments_indexed_by_multipart['mixed']))
{
$hdr .= 'Content-Type: multipart/mixed; boundary="'.$this->_atc_boundary.'"';
-
- $prepared_attachment_parts[] = $this->_prep_attachments($attachments_indexed_by_multipart['mixed'], $this->_atc_boundary);
$last_boundary = $this->_atc_boundary;
}
@@ -1426,14 +1423,12 @@ class CI_Email {
$rel_boundary_header = 'Content-Type: multipart/related; boundary="'.$this->_rel_boundary.'"';
if (isset($last_boundary))
{
- $body .= '--' . $last_boundary . $this->newline . $rel_boundary_header;
+ $body .= '--'.$last_boundary.$this->newline.$rel_boundary_header;
}
else
{
$hdr .= $rel_boundary_header;
}
-
- array_unshift($prepared_attachment_parts, $this->_prep_attachments($attachments_indexed_by_multipart['related'], $this->_rel_boundary));
$last_boundary = $this->_rel_boundary;
}
@@ -1459,12 +1454,15 @@ class CI_Email {
.$this->_prep_quoted_printable($this->_body).$this->newline.$this->newline
.'--'.$this->_alt_boundary.'--'.$this->newline.$this->newline;
- $attachment_prepared = implode($this->newline.$this->newline, $prepared_attachment_parts);
+ ( ! empty($attachments_indexed_by_multipart['related'])) && $body .= $this->newline.$this->newline
+ .$this->_prep_attachments($attachments_indexed_by_multipart['related'], $this->_rel_boundary);
+
+ ( ! empty($attachments_indexed_by_multipart['mixed'])) && $body .= $this->newline.$this->newline
+ .$this->_prep_attachments($attachments_indexed_by_multipart['mixed'], $this->_atc_boundary);
break;
}
- $body .= $attachment_prepared;
$this->_finalbody = ($this->_get_protocol() === 'mail')
? $body
: $hdr.$this->newline.$this->newline.$body;