frontend/models/forms/AnswerTiketForm.php
/**
     * Sends an email to the specified email address using the information collected by this model.
     *
     * @return boolean whether the email was sent
     */
Sends an email to the specified email address using the information collected by this model.
@return boolean whether the email was sent
Sends an email to the specified email address using the information collected by this model . @return boolean whether the email was sent
public function sendEmail()
    {
        $user_id = Yii::$app->user->identity->getId();
        $tk = Tikets::findOne(['tiket_id' => $this->tiket_id, 'user_id' => $user_id]);
        if ($tk) {
            $tkm = new TiketsMessages();
            $tkm->tiket_id     = $this->tiket_id;
            $tkm->message_text = $this->message_text;
            $tkm->user_id      = $user_id;
            $tkm->admin_id     = 0;
            if ($tkm->save()) {
                $tk->tiket_count_new_admin += 1;
                $tk->save();
                $to = Preferences::getValueByKey('adminEmail');
                $from_name = "{$tk->tiket_name} <$tk->tiket_email}>";
                $subject = $tk->tiket_theme;
                return MailTemplatesStatic::sendByKey(MailTemplatesStatic::template_key_standardMailTpl, $to, [
                    'from_name'      => $from_name,
                    'reply_to_email' => $tk->tiket_email,
                    'reply_to_name'  => $tk->tiket_name,
                    'subject'        => $subject,
                    'body'           => $this->message_text,
                ]);
            }
        }
        return false;
    }
public function sendEmail ( ) { $ user_id = Yii :: $ app -> user -> identity -> getId ( ) ; $ tk = Tikets :: findOne ( [ 'tiket_id' => $ this -> tiket_id , 'user_id' => $ user_id ] ) ; if ( $ tk ) { $ tkm = new TiketsMessages ( ) ; $ tkm -> tiket_id = $ this -> tiket_id ; $ tkm -> message_text = $ this -> message_text ; $ tkm -> user_id = $ user_id ; $ tkm -> admin_id = 0 ; if ( $ tkm -> save ( ) ) { $ tk -> tiket_count_new_admin += 1 ; $ tk -> save ( ) ; $ to = Preferences :: getValueByKey ( 'adminEmail' ) ; $ from_name = " { $ tk -> tiket_name }  < $ tk -> tiket_email }> " ; $ subject = $ tk -> tiket_theme ; return MailTemplatesStatic :: sendByKey ( MailTemplatesStatic :: template_key_standardMailTpl , $ to , [ 'from_name' => $ from_name , 'reply_to_email' => $ tk -> tiket_email , 'reply_to_name' => $ tk -> tiket_name , 'subject' => $ subject , 'body' => $ this -> message_text , ] ) ; } } 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 .
/* @var $tk \common\models\Tikets */ //'from_email'     => 'robot@pvtbox.net',