繁体   English   中英

我无法发送电子邮件CakePHP

[英]I can't send email CakePHP

它正在测试我的应用程序,其中您使用cakephp创建了一个Web服务。 在测试和调试应用程序时,我始终将核心价值保持为2。所有这些对我来说都是有效的,现在是时候尝试所有核心0了,除发送电子邮件外,其他所有功能都有效。 但是通过更改核心2(如果已发送)而不了解原因。

        $this->Email->to(array('username' => $responsable['User']['email']));
        $this->Email->subject = "Nuevo View";
        $this->Email->from = 'example@example.com';
        $this->Email->template = 'view_notification';
        $this->Email->layout = 'default';
        $this->Email->sendAs = 'html';
        $result = $this->Email->send();

这不是最佳解决方案,但是它将完全为您服务。 我想您的函数是sendMail()通过它您可以发送邮件。尝试执行以下操作:-

public function sendMail(){

Configure::write('debug', 2); // just on debug mode specially for this function

$this->Email->to(array('username' => $responsable['User']['email']));
        $this->Email->subject = "Nuevo View";
        $this->Email->from = 'example@example.com';
        $this->Email->template = 'view_notification';
        $this->Email->layout = 'default';
        $this->Email->sendAs = 'html';
        $result = $this->Email->send();

}

注意:-这是一个示例,因为我不知道您的函数名称以及该函数中还有哪些其他内容。 只需将debug mod line放在函数的第一行即可完成工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM