common/repositories/ContactUsRepository.php
/**
    * Compose new Email,use admin-dashboard email template
    * @return boolean
    */
Compose new Email,use admin-dashboard email template
@return boolean
Compose new Email use admin - dashboard email template @return boolean
public function sendEmail($email_data){
        $data['id'] = null;
        $data['receiver_id'] = $this->user->find()->where(['email'=> $email_data['to']])->one()->id;
        $data['sender_id'] = $this->getAdminId()->id;
        $data['email'] = $email_data['to'];
        $data['subject'] = $email_data['subject'];
        $data['message'] = $email_data['message'];
        try {
            $subject = $email_data['subject'];
           \Yii::$app->mailer->compose('compose-html',[
                'content' => $data,
            ])
           ->setFrom(\Yii::$app->config->get('App.ContactEmail'))
           ->setTo($data['email'])
           ->setSubject($subject)
           ->send();
           $this->createNewReplySupportMessage($data);
           return "Mail has been Successfuly Sended";
        } catch (RuntimeException $e) {
            return "Sorry error Occured";
        }
    }
public function sendEmail ( $ email_data ) { $ data [ 'id' ] = null ; $ data [ 'receiver_id' ] = $ this -> user -> find ( ) -> where ( [ 'email' => $ email_data [ 'to' ] ] ) -> one ( ) -> id ; $ data [ 'sender_id' ] = $ this -> getAdminId ( ) -> id ; $ data [ 'email' ] = $ email_data [ 'to' ] ; $ data [ 'subject' ] = $ email_data [ 'subject' ] ; $ data [ 'message' ] = $ email_data [ 'message' ] ; try { $ subject = $ email_data [ 'subject' ] ; \ Yii :: $ app -> mailer -> compose ( 'compose-html' , [ 'content' => $ data , ] ) -> setFrom ( \ Yii :: $ app -> config -> get ( 'App.ContactEmail' ) ) -> setTo ( $ data [ 'email' ] ) -> setSubject ( $ subject ) -> send ( ) ; $ this -> createNewReplySupportMessage ( $ data ) ; return " Mail has been Successfuly Sended " ; } catch ( RuntimeException $ e ) { return " Sorry error Occured " ; } }
Compose new Email,use admin-dashboard email template
 @return boolean
Compose new Email use admin - dashboard email template @return boolean