<?php
namespace frontend\controllers;

use Yii;
use yii\web\Controller;

class SiteController extends BaseController
{
    public function actionIndex()
    {
        return $this->render('index');
    }

    /**
     * 错误处理器
     * @return string|\yii\web\Response
     */
    public function actionError()
    {
        $handler = Yii::$app->getErrorHandler();
        $exception = $handler->exception;
        if ($exception == null) {
            // 没有异常
            $exception = new NotFoundHttpException();
        }
        $response = Yii::$app->getResponse();
        $response->setStatusCodeByException($exception);

        return $this->renderPartial('/site/error404.php');
    }

    public function actionTest()
    {
        $mail = Yii::$app->mailer;
        $mail= $mail->compose();
        $mail->setTo('339140399@qq.com');
        $mail->setSubject("Test title");
       // $mail->setTextBody('Test content');
        $mail->setHtmlBody("<br>问我我我我我");    //发布可以带html标签的文本
        var_dump($mail->send());

    }
    
}
