selfhosted/models/forms/SupportForm.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()
    {
        $to = Preferences::getValueByKey("supportEmail_{$this->subject}", Preferences::getValueByKey('adminEmail'));
        if (Yii::$app->user->isGuest) {
            $User = null;
            $from_name = "{$this->name} <{$this->email}>";
            $reply_to_email = $this->email;
            $reply_to_name  = $this->name;
        } else {
            $User = SelfHostUsers::findIdentity(Yii::$app->user->getId());
            $from_name = "{$User->shu_name} <{$User->shu_email}>";
            $reply_to_email = $User->shu_email;
            $reply_to_name  = $User->shu_name;
        }
        $subject = self::getSubjectLabel($this->subject) . " from {$from_name}";
        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'        => $subject,
            'body'           => $this->body,
            'to_name'        => 'Support',
        ]);
    }
public function sendEmail ( ) { $ to = Preferences :: getValueByKey ( " supportEmail_ { $ this -> subject } " , Preferences :: getValueByKey ( 'adminEmail' ) ) ; if ( Yii :: $ app -> user -> isGuest ) { $ User = null ; $ from_name = " { $ this -> name }  < { $ this -> email } > " ; $ reply_to_email = $ this -> email ; $ reply_to_name = $ this -> name ; } else { $ User = SelfHostUsers :: findIdentity ( Yii :: $ app -> user -> getId ( ) ) ; $ from_name = " { $ User -> shu_name }  < { $ User -> shu_email } > " ; $ reply_to_email = $ User -> shu_email ; $ reply_to_name = $ User -> shu_name ; } $ subject = self :: getSubjectLabel ( $ this -> subject ) . "  from  { $ from_name } " ; 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' => $ subject , 'body' => $ this -> body , 'to_name' => 'Support' , ] ) ; }
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 $user \common\models\SelfHostUsers */ //'from_email'     => 'support@pvtbox.net',