frontend/models/forms/PricingFeedbackForm.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()
    {
        if (Yii::$app->user->isGuest) {
            $User = null;
        } else {
            $User = Users::findIdentity(Yii::$app->user->getId());
        }
        $to = Preferences::getValueByKey("supportEmail_OTHER", Preferences::getValueByKey('adminEmail'));
        $from_name = "{$this->name} <{$this->email}>";
        $reply_to_email = $this->email;
        $reply_to_name  = $this->name;
        $body = "Message from pricing feedback form\n\n" .
                "Name: {$this->name}\n" .
                "Organization: {$this->organization}\n" .
                "Email: {$this->email}\n" .
                "Phone: {$this->phone}\n" .
                "Number of users: {$this->count_users}\n" .
                "Additional information: \n\n" . $this->body . "\n";
        $ms = new MessagesStore();
        $ms->ms_data = $body;
        $ms->ms_type = MessagesStore::TYPE_PRICING;
        $ms->user_id = ($User) ? $User->user_id : null;
        $ms->save();
        return MailTemplatesStatic::sendByKey(MailTemplatesStatic::template_key_standardMailTpl, $to, [
            'from_name'      => $from_name,
            'reply_to_email' => $reply_to_email,
            'reply_to_name'  => $reply_to_name,
            'subject'        => 'From pricing feedback form',
            'body'           => $body,
            'to_name'        => 'Support',
            'UserObject'     => $User,
        ]);
    }
public function sendEmail ( ) { if ( Yii :: $ app -> user -> isGuest ) { $ User = null ; } else { $ User = Users :: findIdentity ( Yii :: $ app -> user -> getId ( ) ) ; } $ to = Preferences :: getValueByKey ( " supportEmail_OTHER " , Preferences :: getValueByKey ( 'adminEmail' ) ) ; $ from_name = " { $ this -> name }  < { $ this -> email } > " ; $ reply_to_email = $ this -> email ; $ reply_to_name = $ this -> name ; $ body = " Message from pricing feedback form \n \n " . " Name:  { $ this -> name } \n " . " Organization:  { $ this -> organization } \n " . " Email:  { $ this -> email } \n " . " Phone:  { $ this -> phone } \n " . " Number of users:  { $ this -> count_users } \n " . " Additional information:  \n \n " . $ this -> body . " \n " ; $ ms = new MessagesStore ( ) ; $ ms -> ms_data = $ body ; $ ms -> ms_type = MessagesStore :: TYPE_PRICING ; $ ms -> user_id = ( $ User ) ? $ User -> user_id : null ; $ ms -> save ( ) ; return MailTemplatesStatic :: sendByKey ( MailTemplatesStatic :: template_key_standardMailTpl , $ to , [ 'from_name' => $ from_name , 'reply_to_email' => $ reply_to_email , 'reply_to_name' => $ reply_to_name , 'subject' => 'From pricing feedback form' , 'body' => $ body , 'to_name' => 'Support' , 'UserObject' => $ User , ] ) ; }
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 .
//'from_email'     => 'support@pvtbox.net',