0
我嘗試了,雖然我已經在1 這裏摘錄如下菜譜1從我的控制器類「cakeEmail」未找到 - cakephp2
App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');
...
...
...
public function index() {
....
$Email = new cakeEmail('smtp');
$Email->template('MassMail')
->emailFormat('html')
->viewVars([
'content' => $content
])
->from(['[email protected]' => 'Forkom Jerman'])
->to($to)
->subject($subject)
->replyTo('[email protected]')
->transport('smtp');
if ($Email->send()) {
$this->Flash->set('Email Telah terkirim');
} else {
$this->Flash->set('Email tidak bisa terkirim');
}
}
}
和電子郵件與cakeMail發送電子郵件時,該eror。在PHP的config文件夾:
class EmailConfig {
public $smtp = array(
'transport' => 'Smtp',
'from' => '[email protected]',
'host' => 'send.one.com',
'port' => 465,
'username' => '*****@gmail.com',
'password' => '******',
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
);
}
請告訴我哪裏出問題, 感謝!
你試試這樣說:'$電子郵件=新CakeEmail( 'SMTP');'? – Bart