Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove CakePHP firm "This email was generated with CakePHP Framework" from CakeEmails

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!

like image 886
content01 Avatar asked May 14 '12 19:05

content01


2 Answers

The Short Answer

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).


The Slightly Longer Answer

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.

like image 186
Glen Balliet Avatar answered Oct 25 '22 08:10

Glen Balliet


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.

like image 31
aDvo Avatar answered Oct 25 '22 07:10

aDvo