diff --git a/app/View/elements/email/html/empty b/app/View/emails/html/empty
similarity index 100%
rename from app/View/elements/email/html/empty
rename to app/View/emails/html/empty
diff --git a/app/View/elements/email/text/empty b/app/View/emails/text/empty
similarity index 100%
rename from app/View/elements/email/text/empty
rename to app/View/emails/text/empty
diff --git a/app/View/layouts/email/html/empty b/app/View/layouts/emails/html/empty
similarity index 100%
rename from app/View/layouts/email/html/empty
rename to app/View/layouts/emails/html/empty
diff --git a/app/View/layouts/email/text/empty b/app/View/layouts/emails/text/empty
similarity index 100%
rename from app/View/layouts/email/text/empty
rename to app/View/layouts/emails/text/empty
diff --git a/lib/Cake/Console/templates/skel/View/elements/email/html/default.ctp b/lib/Cake/Console/templates/skel/View/emails/html/default.ctp
similarity index 100%
rename from lib/Cake/Console/templates/skel/View/elements/email/html/default.ctp
rename to lib/Cake/Console/templates/skel/View/emails/html/default.ctp
diff --git a/lib/Cake/Console/templates/skel/View/elements/email/text/default.ctp b/lib/Cake/Console/templates/skel/View/emails/text/default.ctp
similarity index 100%
rename from lib/Cake/Console/templates/skel/View/elements/email/text/default.ctp
rename to lib/Cake/Console/templates/skel/View/emails/text/default.ctp
diff --git a/lib/Cake/Console/templates/skel/View/layouts/email/html/default.ctp b/lib/Cake/Console/templates/skel/View/layouts/emails/html/default.ctp
similarity index 100%
rename from lib/Cake/Console/templates/skel/View/layouts/email/html/default.ctp
rename to lib/Cake/Console/templates/skel/View/layouts/emails/html/default.ctp
diff --git a/lib/Cake/Console/templates/skel/View/layouts/email/text/default.ctp b/lib/Cake/Console/templates/skel/View/layouts/emails/text/default.ctp
similarity index 100%
rename from lib/Cake/Console/templates/skel/View/layouts/email/text/default.ctp
rename to lib/Cake/Console/templates/skel/View/layouts/emails/text/default.ctp
diff --git a/lib/Cake/Network/CakeEmail.php b/lib/Cake/Network/CakeEmail.php
index 251b179ed0c..7b49eeeb6ab 100644
--- a/lib/Cake/Network/CakeEmail.php
+++ b/lib/Cake/Network/CakeEmail.php
@@ -1261,14 +1261,13 @@ protected function _render($content) {
}
$View = new $viewClass(null);
- $View->layout = $this->_layout;
$View->viewVars = $this->_viewVars;
$msg = array();
$content = implode("\n", $content);
if ($this->_emailFormat === 'both') {
- $htmlContent = $content;
+ $originalContent = $content;
if (!empty($this->_attachments)) {
$msg[] = '--' . $this->_boundary;
$msg[] = 'Content-Type: multipart/alternative; boundary="alt-' . $this->_boundary . '"';
@@ -1279,10 +1278,10 @@ protected function _render($content) {
$msg[] = 'Content-Transfer-Encoding: 7bit';
$msg[] = '';
- $content = $View->element('email' . DS . 'text' . DS . $this->_template, array('content' => $content), true);
- $View->layoutPath = 'email' . DS . 'text';
- $content = explode("\n", $this->_textMessage = str_replace(array("\r\n", "\r"), "\n", $View->renderLayout($content)));
-
+ $View->viewPath = $View->layoutPath = 'emails' . DS . 'text';
+ $View->viewVars['content'] = $originalContent;
+ $this->_textMessage = str_replace(array("\r\n", "\r"), "\n", $View->render($this->_template, $this->_layout));
+ $content = explode("\n", $this->_textMessage);
$msg = array_merge($msg, $content);
$msg[] = '';
@@ -1291,10 +1290,13 @@ protected function _render($content) {
$msg[] = 'Content-Transfer-Encoding: 7bit';
$msg[] = '';
- $htmlContent = $View->element('email' . DS . 'html' . DS . $this->_template, array('content' => $htmlContent), true);
- $View->layoutPath = 'email' . DS . 'html';
- $htmlContent = explode("\n", $this->_htmlMessage = str_replace(array("\r\n", "\r"), "\n", $View->renderLayout($htmlContent)));
- $msg = array_merge($msg, $htmlContent);
+ $View->viewPath = $View->layoutPath = 'emails' . DS . 'html';
+ $View->viewVars['content'] = $originalContent;
+ $View->hasRendered = false;
+ $this->_htmlMessage = str_replace(array("\r\n", "\r"), "\n", $View->render($this->_template, $this->_layout));
+ $content = explode("\n", $this->_htmlMessage);
+ $msg = array_merge($msg, $content);
+
$msg[] = '';
$msg[] = '--alt-' . $this->_boundary . '--';
$msg[] = '';
@@ -1317,9 +1319,10 @@ protected function _render($content) {
}
}
- $content = $View->element('email' . DS . $this->_emailFormat . DS . $this->_template, array('content' => $content), true);
- $View->layoutPath = 'email' . DS . $this->_emailFormat;
- $content = explode("\n", $rendered = str_replace(array("\r\n", "\r"), "\n", $View->renderLayout($content)));
+ $View->viewPath = $View->layoutPath = 'emails' . DS . $this->_emailFormat;
+ $View->viewVars['content'] = $content;
+ $rendered = $View->render($this->_template, $this->_layout);
+ $content = explode("\n", $rendered);
if ($this->_emailFormat === 'html') {
$this->_htmlMessage = $rendered;
diff --git a/lib/Cake/View/elements/email/html/default.ctp b/lib/Cake/View/emails/html/default.ctp
similarity index 100%
rename from lib/Cake/View/elements/email/html/default.ctp
rename to lib/Cake/View/emails/html/default.ctp
diff --git a/lib/Cake/View/elements/email/text/default.ctp b/lib/Cake/View/emails/text/default.ctp
similarity index 100%
rename from lib/Cake/View/elements/email/text/default.ctp
rename to lib/Cake/View/emails/text/default.ctp
diff --git a/lib/Cake/View/layouts/email/html/default.ctp b/lib/Cake/View/layouts/emails/html/default.ctp
similarity index 100%
rename from lib/Cake/View/layouts/email/html/default.ctp
rename to lib/Cake/View/layouts/emails/html/default.ctp
diff --git a/lib/Cake/View/layouts/email/text/default.ctp b/lib/Cake/View/layouts/emails/text/default.ctp
similarity index 100%
rename from lib/Cake/View/layouts/email/text/default.ctp
rename to lib/Cake/View/layouts/emails/text/default.ctp
diff --git a/lib/Cake/tests/test_app/View/elements/email/html/custom.ctp b/lib/Cake/tests/test_app/View/emails/html/custom.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/elements/email/html/custom.ctp
rename to lib/Cake/tests/test_app/View/emails/html/custom.ctp
diff --git a/lib/Cake/tests/test_app/View/elements/email/html/default.ctp b/lib/Cake/tests/test_app/View/emails/html/default.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/elements/email/html/default.ctp
rename to lib/Cake/tests/test_app/View/emails/html/default.ctp
diff --git a/lib/Cake/tests/test_app/View/elements/email/html/nested_element.ctp b/lib/Cake/tests/test_app/View/emails/html/nested_element.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/elements/email/html/nested_element.ctp
rename to lib/Cake/tests/test_app/View/emails/html/nested_element.ctp
diff --git a/lib/Cake/tests/test_app/View/elements/email/text/custom.ctp b/lib/Cake/tests/test_app/View/emails/text/custom.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/elements/email/text/custom.ctp
rename to lib/Cake/tests/test_app/View/emails/text/custom.ctp
diff --git a/lib/Cake/tests/test_app/View/elements/email/text/default.ctp b/lib/Cake/tests/test_app/View/emails/text/default.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/elements/email/text/default.ctp
rename to lib/Cake/tests/test_app/View/emails/text/default.ctp
diff --git a/lib/Cake/tests/test_app/View/elements/email/text/wide.ctp b/lib/Cake/tests/test_app/View/emails/text/wide.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/elements/email/text/wide.ctp
rename to lib/Cake/tests/test_app/View/emails/text/wide.ctp
diff --git a/lib/Cake/tests/test_app/View/layouts/email/html/default.ctp b/lib/Cake/tests/test_app/View/layouts/emails/html/default.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/layouts/email/html/default.ctp
rename to lib/Cake/tests/test_app/View/layouts/emails/html/default.ctp
diff --git a/lib/Cake/tests/test_app/View/layouts/email/html/thin.ctp b/lib/Cake/tests/test_app/View/layouts/emails/html/thin.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/layouts/email/html/thin.ctp
rename to lib/Cake/tests/test_app/View/layouts/emails/html/thin.ctp
diff --git a/lib/Cake/tests/test_app/View/layouts/email/text/default.ctp b/lib/Cake/tests/test_app/View/layouts/emails/text/default.ctp
similarity index 100%
rename from lib/Cake/tests/test_app/View/layouts/email/text/default.ctp
rename to lib/Cake/tests/test_app/View/layouts/emails/text/default.ctp