0

我正在使用 CakePHP 2.3.0 和 CakeEmail。

我可以毫无问题地发送电子邮件。为了删除“这封电子邮件是用 CakePHP 框架生成的”,它总是附加到我希望找到并删除的已发送电子邮件中

<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; ?>

所以我会怎么做才能删除这个看不见的代码行希望这可以做到非常感谢!

4

2 回答 2

1

我假设您删除了该行,app\View\Layouts\Emails\html\default.ctp但可以发送两种格式。Html,文本或两者兼而有之。html 和 text 格式都有自己的布局。发送的默认格式是文本,除非使用方法另行设置,因此如果您还没有这样做,请emailFormat(...)尝试修改文本格式的布局。app\View\Layouts\Emails\text\default.ctp

于 2013-06-06T06:44:14.560 回答
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
于 2013-06-06T12:23:12.050 回答