我正在使用来自Jotlab的Sign Me Up插件,并且在发送电子邮件时遇到问题。我试图联系作者但到目前为止没有运气。
我正在使用这个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;
}
}
}
我已经阅读了关于电子邮件的蛋糕文档,并尝试了很多方面,包括不止一次重新安装。
非常感谢有关如何解决这些错误消息的任何帮助。
谢谢,保罗
答案 0 :(得分:0)
找到了丢失的文件。由于某种原因,我在视图/电子邮件/文本中的'default.ctp'文件丢失了。还要确保其中包含以下代码:
<?php echo $content; ?>
电子邮件现在工作正常。