我正在尝试在 cakephp 中调试我的电子邮件,因为我无法发送测试邮件。但是,我所做的一切都只给了我一个空白网页,甚至是调试。我已经将调试模式设置为 2。以下是我的代码:
C:\xampp\htdocs\NewFolder\app\webroot\email\app\controllersmailer_controller.php
<?php
class MailerController extends AppController {
var $name = 'Mailer';
//Not using a model
var $uses = '';
//The built in Cake Mailer
var $components = array('Email');
$this->Email->delivery = 'debug';
/**
* Send a text string as email body
*/
function sendSimpleMail() {
//$this->Email->to = 'yourlogin@localhost';
$this->Email->to = 'csorila17@gmail.com';
$this->Email->subject = 'Cake test simple email';
$this->Email->replyTo = 'noreply@example.com';
$this->Email->from = 'Cake Test Account <noreply@example.com>';
//Set the body of the mail as we send it.
//Note: the text can be an array, each element will appear as a
//seperate line in the message body.
if ( $this->Email->send('Here is the body of the email') ) {
$this->Session->setFlash('Simple email sent');
} else {
$this->Session->setFlash('Simple email not sent');
}
//$this->redirect('/');
$this->Email->delivery = 'debug';
}
}
?>
C:\xampp\htdocs\NewFolder\app\webroot\email\app\views\layouts\default.ctp
<?php echo $this->Session->flash(); ?>
<?php echo $this->Session->flash('email'); ?>
C:\xampp\htdocs\NewFolder\app\webroot\email\app\views\layouts\email\html\default.ctp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body>
<?php echo $content_for_layout; ?>
<?php echo $this->Session->flash(); ?>
<?php echo $this->Session->flash('email'); ?>
</body>
</html>
C:\xampp\htdocs\NewFolder\app\webroot\email\app\views\layouts\email\text\default.ctp
<?php echo $content_for_layout; ?>