framework/mail/BaseMailer.php
protected function createMessage()
    {
        $config = $this->messageConfig;
        if (!array_key_exists('class', $config)) {
            $config['class'] = $this->messageClass;
        }
        $config['mailer'] = $this;
        return Yii::createObject($config);
    }
protected function createMessage()
    {
        $config = $this->messageConfig;
        if (!array_key_exists('class', $config)) {
            $config['class'] = $this->messageClass;
        }
        $config['mailer'] = $this;
        return Yii::createObject($config);
    }
Creates a new message instance.
The newly created instance will be initialized with the configuration specified by [[messageConfig]].
If the configuration does not specify a 'class', the [[messageClass]] will be used as the class
of the new message instance.
@return MessageInterface message instance.