frontend/models/ContactForm.php
/**
     * Sends an email to the specified email address using the information collected by this model.
     *
     * @return bool whether the email was sent
     */
Sends an email to the specified email address using the information collected by this model.
@return bool whether the email was sent
Sends an email to the specified email address using the information collected by this model . @return bool whether the email was sent
public function sendEmail()
    {
        $contact = new Contact();
        $contact->category = $this->category;
        $contact->email = $this->email;
        $contact->body = $this->body;
        $contact->date = date('Y-m-d H:i:s');
        $contact->isRead = 0;
        if ($contact->validate()) {
            $contact->save();
            $contact->refresh();
            return true;
        } else {
            return false;
        }
    }
public function sendEmail ( ) { $ contact = new Contact ( ) ; $ contact -> category = $ this -> category ; $ contact -> email = $ this -> email ; $ contact -> body = $ this -> body ; $ contact -> date = date ( 'Y-m-d H:i:s' ) ; $ contact -> isRead = 0 ; if ( $ contact -> validate ( ) ) { $ contact -> save ( ) ; $ contact -> refresh ( ) ; return true ; } else { return false ; } }
Sends an email to the specified email address using the information collected by this model.
Sends an email to the specified email address using the information collected by this model .