0
我正在使用來自Jotlab的Sign Me Up插件,並且在發送電子郵件時遇到問題。我試圖聯繫作者,但至今沒有運氣。如何在Sign Me Up插件中出錯CakePHP電子郵件組件錯誤
我用一個ACL插件和一切,但發送電子郵件到目前爲止工作。所有的研究和解決問題都沒有得到任何答案。
這是一個cakephp 2.x版本,我知道電子郵件組件已被棄用,但應該可以工作。
當我提交註冊表單時,記錄確實被插入,但電子郵件未發送,並且出現此錯誤消息。
#0 C:\wamp\www\blue2\lib\Cake\Network\Email\CakeEmail.php(967): MailTransport->send(Object(CakeEmail))
#1 C:\wamp\www\blue2\lib\Cake\Controller\Component\EmailComponent.php(345): CakeEmail->send(Array)
#2 C:\wamp\www\blue2\app\Plugin\sign_me_up\Controller\Component\SignMeUpComponent.php(143): EmailComponent->send(Array)
#3 C:\wamp\www\blue2\app\Plugin\sign_me_up\Controller\Component\SignMeUpComponent.php(103): SignMeUpComponent->__sendActivationEmail(Array)
#4 C:\wamp\www\blue2\app\Plugin\AclManagement\Controller\UsersController.php(57): SignMeUpComponent->register()
#5 [internal function]: UsersController->register()
#6 C:\wamp\www\blue2\lib\Cake\Controller\Controller.php(473): ReflectionMethod->invokeArgs(Object(UsersController), Array)
#7 C:\wamp\www\blue2\lib\Cake\Routing\Dispatcher.php(104): Controller->invokeAction(Object(CakeRequest))
#8 C:\wamp\www\blue2\lib\Cake\Routing\Dispatcher.php(86): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
#9 C:\wamp\www\blue2\app\webroot\index.php(96): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#10 {main}
下面是在控制器的寄存器功能代碼:
public function register() {
$this->__isLoggedIn();
if (!empty($this->data)) {
extract($this->settings);
$model = $this->controller->modelClass;
$this->controller->loadModel($model);
$this->controller->{$model}->set($this->data);
if (CakePlugin::loaded('Mongodb')) {
$this->controller->{$model}->Behaviors->attach('Mongodb.SqlCompatible');
}
if ($this->controller->{$model}->validates()) {
if (!empty($activation_field)) {
$this->data[$model][$activation_field] = $this->controller->{$model}->generateActivationCode($this->data);
} elseif (!empty($useractive_field)) {
$this->data[$model][$useractive_field] = true;
}
if ($this->controller->{$model}->save($this->data, false)) {
//If an activation field is supplied send out an email
if (!empty($activation_field)) {
$this->__sendActivationEmail($this->data[$model]);
if (!$this->controller->request->is('ajax')) {
$this->controller->redirect(array('action' => 'activate'));
} else {
return true;
}
} else {
$this->__sendWelcomeEmail($this->data[$model]);
}
if (!$this->controller->request->is('ajax')) {
$this->controller->redirect($this->Auth->loginAction);
} else {
return true;
}
}
}
}
}
「發送激活郵件」和「發送歡迎電子郵件」如下:
protected function __sendActivationEmail($userData) {
$this->__setUpEmailParams($userData);
$this->__parseEmailSubject('activation', $userData);
if ($this->__setTemplate(Configure::read('SignMeUp.activation_template'))) {
if ($this->Email->send($userData)) {
return true;
}
}
}
protected function __sendWelcomeEmail($userData) {
$this->__setUpEmailParams($userData);
$this->__parseEmailSubject('welcome', $userData);
if ($this->__setTemplate(Configure::read('SignMeUp.welcome_template'))) {
if ($this->Email->send($userData)) {
return true;
}
}
}
我已經閱讀了關於電子郵件的蛋糕文檔,並嘗試了許多事情,包括多次重新安裝。
任何有關如何解決這些錯誤消息的幫助非常感謝。
謝謝,保羅