我正在使用CakePHP 2.3.0和CakeEmail。
我可以毫无问题地发送电子邮件。 为了删除 “此电子邮件是使用CakePHP Framework生成的”,始终附加到已发送的电子邮件中 我期待找到并删除
<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>
但它不是默认模板的一部分 希望这可以做到 非常感谢你!
在cakephp 2.3.2中/app/View/Emails/html/default.ctp的内容如下所示
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.View.Emails.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<?php
$content = explode("\n", $content);
foreach ($content as $line):
echo '<p> ' . $line . "</p>\n";
endforeach;
?>
/app/View/Emails/html/default.ctp的内容如下所示
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.View.Emails.text
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<?php echo $content; ?>
那么我将如何删除这段看不见的代码 希望这可以做到 非常感谢你!
答案 0 :(得分:1)
我假设你从app\View\Layouts\Emails\html\default.ctp
删除了该行,但有两种格式可以发送。 HTML,文本或两者。 html和文本格式都有自己的布局。发送的默认格式是文本,除非使用emailFormat(...)
方法另外设置,因此如果您还没有这样做,请尝试在app\View\Layouts\Emails\text\default.ctp
中修改文本格式的布局。
答案 1 :(得分:0)
please can you comment last php tag from following file
1) app\View\Layouts\Emails\text\default.ctp
2) app\View\Layouts\Emails\html\default.ctp
and then check it works fine