私を助けることができるすべての人、私はCakePHPの初心者であり、連絡フォームに問題があります。私はこのチュートリアルに従いましたhttp://blog.jandorsman.com/2011/05/cakephp-contact-form-with-validation-rules/
しかし、私の受信トレイは空です:(私はメッセージを受け取りました:あなたのメッセージは送信されました。ありがとう、すぐに返信します。しかし、効果はありません:( ..何が問題なのですか?
私のコントローラー:
<?php
class ContactsController extends AppController {
var $components = array('Email');
var $helpers = array('Html', 'Form');
function send() {
if(!empty($this->data)) {
$this->Contact->set($this->data);
if($this->Contact->validates()) {
if(!empty($this->data['Contact']['company'])) {
$this->Email->from = $this->data['Contact']['company'] . ' - ' . $this->data['Contact']['name'] . ' <' . $this->data['Contact']['email'] . '>';
} else {
$this->Email->from = $this->data['Contact']['name'] . ' <' . $this->data['Contact']['email'] . '>';
}
$this->Email->to = 'info@mycompany.com';
$this->Email->subject = 'Website request';
$this->Email->send($this->data['Contact']['message']);
$this->Session->setFlash('Your message has been sent.');
// Display the success.ctp page instead of the form again
$this->render('success');
} else {
$this->render('index');
}
}
}
public function index() {
// Placeholder for index. No actual action here, everything is submitted to the send function.
}
}
?>