I'm working with CakePHP 2.0 and CakeEmail.
I'm able to send emails without any problems.
However, I would like to remove the
"This email was generated with CakePHP Framework"
being added at the end of every single email my app sends. Is that possible?
Thank you so much!
It's in /app/View/Layouts/Emails/html/default.ctp
and /app/View/Layouts/Emails/text/default.ctp
.
It is NOT in /app/View/Emails/html/default.ctp
or /app/View/Emails/text/default.ctp
. For some reason, editing these files doesn't make a difference (it would seem).
By default, /app/View/Layouts/Emails/html/default.ctp
looks like this:
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.View.Layouts.Emails.html
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title><?php echo $title_for_layout;?></title>
</head>
<body>
<?php echo $content_for_layout;?>
<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>
</body>
</html>
To remove the footer, delete this line:
<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>
Then do the same thing with /app/View/Layouts/Emails/text/default.ctp
.
This is 2 years old. But i'd suggest a possibly more "correct" alternative, although it was Glen Balliets answer that led me to this.
Rather than messing around with the default layout... you can also call this before sending your email.
$cakeemail->template('viewtemplate',null);
Where the 1st parameter is the name of the view, and 2nd parameter NULL means to not use any layout for the email. Its documented here http://api.cakephp.org/2.3/class-CakeEmail.html which states you are able to set layout as null.
IF your using an editor like aptena, eclipse, dreamweaver I'd say do a grep style search on the contents of the files within cakephp looking for that phrase. Cause it has to be hardcoded in somewhere in some fashion within the framework.
Not sure if removing something like that is against the terms of use with cake but. if you wanted to remove it that would be my start, seeing as I am not 100% familiar with the file structure of cake.
That line is actually part of the e-mail layout located at app/View/Layouts/Emails/text/default.ctp
and app/View/Layouts/Emails/html/default.ctp
for HTML mail. You may safely edit it out. More about e-mail templates in the CakePHP book .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.