蛋糕电子邮件不起作用


Cake email not working

蛋糕电子邮件不起作用

这是代码应用程序/配置/电子邮件.php

public $default = array(
    'transport' => 'Mail',
    'from' => 'abcd@gmail.com',
    //'charset' => 'utf-8',
    //'headerCharset' => 'utf-8',
);

和在应用程序/控制器/用户控制器中

email = new CakeEmail();
                $email->template('activate_your_account', 'default')
                        ->config('smtp')
                        ->emailFormat('html')
                        ->subject(__('Account Verification - ' . Configure::read('Application.name')))
                        ->to($user)
                        ->from(Configure::read('Application.from_email'))
                        ->viewVars(array('hash' => $hash, 'id' => $id))
                        ->send();

当我运行它时,我收到像An internal error has occurred这样的错误。 请帮助我。

编辑:现在我已经解决了这个错误,谢谢

您需要配置 SMTP 服务器。有关详细信息,请参阅此页面:http://book.cakephp.org/2.0/en/core-utility-libraries/email.html

您的示例显示没有邮件服务器配置